Detailed Description
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following description will be made with reference to the accompanying drawings. It is obvious that the drawings in the following description are only some examples of the invention, and that for a person skilled in the art, other drawings and embodiments can be derived from them without inventive effort.
For the sake of simplicity, the drawings only schematically show the parts relevant to the present invention, and they do not represent the actual structure as a product. In addition, in order to make the drawings concise and understandable, components having the same structure or function in some of the drawings are only schematically illustrated or only labeled. In addition, "upper, lower", "left, right", "front, rear", "one, another", and the like appearing in the present invention are relative concepts unless otherwise specified.
In one embodiment of the present invention, as shown in fig. 1, an automatic photography composition method includes:
step S100 acquires contour information of a photographic subject.
Specifically, the shooting target may be an adult or a child, and may be one or more characters, as needed. When the photographic subject is a person, the contour information includes position information of the head, body, and joint points of the person, and the contour of the person can be described by the position information. Since the contour information is used for the photography and composition service, the accurate information of the human body curve does not need to be obtained, and a closed geometric body with a slightly larger volume and simple characteristics can be used for replacing the contour information. As an example, as shown in fig. 6, contour information of a person, in which head position information is expressed by a position of a rectangular box (head box 1) containing a head, further, may be expressed by upper left point coordinates and lower right point coordinates of the head box, or by lower left point coordinates and upper right point coordinates; the body position information is expressed by the position of a rectangular frame (body frame 3) containing the body, and further, may be expressed by the upper left point coordinate and the lower right point coordinate of the body frame, or by the lower left point coordinate and the upper right point coordinate; each joint point expressed by the coordinates of the center point (joint point 4) of each joint; this can reduce the amount of data to be processed and the computational complexity of photography. The contour information can be obtained by human body detection and key point detection technologies.
Step S200 is to generate an initial framing frame for the shooting target according to the outline information.
Specifically, the composition frame is a closed frame having a certain shape and size, and defines the shape and size of the photographed image. Generally, a framing frame is a rectangular frame with a left-right width greater than a top-bottom height. When the camera rotates 90 degrees to realize vertical shooting, the height of the framing frame is larger than the width of the framing frame. The aspect ratio of the framing frame is required to be certain, and mainly depends on the size of a sensor of a photographic part such as a camera, and the formats are popular, such as 3:2 format, 1:1, 4:3 format, and the like, so that the framing frame needs to meet the requirement of the preset photographic aspect ratio.
In order to avoid the phenomenon that the integrity of a person is damaged by cropping or cutting limbs of a shooting target in a picture or an image output by shooting, a framing frame needs to be generated according to the outline information of the shooting target. Optionally, according to the photographing requirement, for example, only the upper body of the person needs to be photographed, the upper body information of the photographing target is extracted from the outline information, and the framing frame may only include the upper body information of the photographing target; if there is no special imaging request, the composition frame is required to include the entire outline information of the imaging target, in general, in order to ensure the integrity of the entire person.
In addition, in order to highlight the photographic subject and improve the photographic quality, the photographic subject generally needs to be placed in the center area of the composition frame according to the composition rule. As a preferred embodiment, an outer envelope of the shot object is obtained according to the contour information, optionally taking the shooting requirements into consideration; taking the center of the outer envelope frame as the center of the composition frame, and then obtaining a rectangular frame completely containing the outer envelope frame of the shooting target according to the preset shooting aspect ratio, thus obtaining an ideal composition frame which is at least the composition frame conforming to the preset position composition rule and the preset size composition rule, namely taking a person picture as an example, if only the shooting target and no other persons exist in the composition frame, outputting a shooting according to the composition frame, wherein the corresponding position of the shooting target in the picture (or the picture) conforms to the position composition rule, and the size of the shooting target in the picture (or the picture) also conforms to the size composition rule. The preset position/size composition rule is a set of preset judgments for factors such as the upper, lower, left, right spatial positions/sizes of a shooting target in a picture (or a photo) according to aesthetic requirements of shooting.
In summary, the frame structure obtained according to the contour information of the object is referred to as an initial frame structure.
Step S300 determines whether there are cosubes in the initial framing frame, where the cosubes are other objects that can be photographed.
Specifically, the cosome refers to other photographable targets similar to the photographic target. For example, when the shooting target is a natural person, the accompanying person is another person or a crowd. In a situation such as a situation where a plurality of persons gather, a photographic subject (a specific one of natural persons) is identified and distinguished from one or more accompanying bodies (other natural persons), so that a framed frame with the photographic subject as an image center can be acquired as much as possible, thereby obtaining a portrait of a single person such as a person including only the photographic subject. Therefore, in order to improve the shooting quality of the shooting target, it is necessary to determine whether the cosome or a part of the cosome exists in the initial frame (i.e., the initial frame and the cosome overlap). There may be no cosome, one cosome, or multiple cosomes within the initial framing frame.
In step S400, when there is no cosome in the initial frame, the initial frame is output as a target frame.
Specifically, no cosome exists in the initial frame, which indicates that the currently formed initial frame only includes the shooting target. Since the current frame is already an ideal frame, and a photograph including only a single person, for example, can be acquired, the initial frame can be output as the target frame.
Step S500 determines whether there is a companion body that must also be a photographic subject when the companion body exists in the initial composition frame.
Specifically, when the cosome exists in the initial composition frame, the influence of the cosome needs to be considered, for example, whether the cosome can be removed from the composition frame or not, and the cosome must also be taken as a shooting target. If the image can be moved out of the composition frame, the photographing effect of the photographing object can be further improved. The method comprises the steps of obtaining an initial frame, wherein the initial frame may have one or more cosome, respectively judging whether each cosome is also required to be used as a shooting target, and obtaining whether one cosome which is also required to be used as the shooting target exists according to the judgment result of each cosome. The judging means of each accompany body can be as follows: and calculating the overlapping area of the cosome and the initial framing frame, wherein if the overlapping area is larger than a preset value, the cosome must also be used as a shooting target. Preferably, the overlapping area of each cosome and the initial skeleton frame is calculated, and the proportion of the area to the whole area of the cosome is calculated. When the proportion is larger than or equal to a preset value, the accompany body must also be taken as a shooting target; otherwise, the partner is not a photographic target. As shown in fig. 7, a cosome exists in the initial composition frame, wherein a large frame represents the initial composition frame, a small frame represents the cosome, the left diagram is an example that the cosome must also be taken as a shooting target, and the right diagram is an example that the cosome is not taken as a shooting target; the left graph reflects most of the accompanying body in the initial frame, which shows that the accompanying body is closer to the shooting target, and even if the accompanying body can be moved out by moving the initial frame, the shooting target is located at the edge of the initial frame and does not accord with the preset composition rule, so that the accompanying body is required to be used as a part of the shooting target in the situation.
In step S600, when the cosome exists in the initial composition frame and all the cosomes are not taken as the shooting targets, the cosome influence degree is regenerated to be not more than the current composition frame and the generated composition frame is output as the target composition frame.
Specifically, when the cosome exists in the initial frame, if all the cosomes are not taken as the shooting targets, it is shown that all the cosomes have little influence on the initial frame. This situation can further improve the quality of the shot by regenerating a framed frame with a smaller volume of the cosome influence than the current framed frame. The influence degree of the cosome reflects the influence of the cosome on the framed frame, for example, the cosome is judged by the overlapping area of the cosome and the framed frame or the proportion of the overlapping area to the cosome.
For example, as shown in fig. 8, the left side is an initial composition frame, an accompanying body exists in the composition frame, and the proportion of the overlapping area of the accompanying body and the composition frame to the whole area of the accompanying body is small, which belongs to the situation that the accompanying body is not taken as a shooting target; and obtaining a frame on the right by moving the frame, wherein no cosome exists in the frame, the overlapping area of the cosome and the frame is 0, the influence of the cosome is reduced, and the cosome can be output as a target frame.
For another example, as shown in fig. 9, the left side is an initial frame, a cosome exists in the frame, and when the frame is moved to the left to avoid the right cosome, a new cosome appears on the left side, but obviously, the overlapping area of the new cosome on the left side and the frame is smaller than that of the initial frame, so that a frame with a smaller cosome influence degree can be obtained, and the frame can be output as a target frame.
In some cases, a framed frame with a smaller degree of influence of the accompanying object may not be obtained again compared to the initial framed frame, but because the influence of the accompanying object is small, even if the initial framed frame is output, the accompanying object can be prevented from existing in the actual picture by, for example, cutting the picture after photographing. Further, when a plurality of frame frames with smaller influence degrees of the cosome exist, the frame with the smallest influence degree of the cosome is selected from the frame frames and is output as the target frame.
Step S700, when a cosome exists in the initial composition frame and at least one cosome exists and must also be taken as a shooting target, forming a new shooting target by the cosome which must also be taken as the shooting target and the shooting target, replacing the shooting target with the new shooting target, and jumping to step S100.
Specifically, when an accompanying body exists in the initial frame structure and the accompanying body needs to be brought into the shooting target, the accompanying body and the shooting target are combined to obtain a new shooting target, the new shooting target is used for replacing the shooting target, and the generation and output process of a new round of target frame structure is restarted. When a plurality of cosubs exist in the initial frame construction, and part or all of the cosubs are necessary to be taken as the shooting targets, all the cosubs which are necessary to be taken as the shooting targets are combined with the shooting targets to obtain new shooting targets, the new shooting targets are used for replacing the shooting targets, and the generation and output processes of a new round of target frame construction are restarted.
The usual photography process is: finding a shooting target, adjusting a shooting component (such as a camera) to be aligned with the shooting target, wherein an image containing the shooting target exists in the visual field of the shooting component, and then setting a framing frame (similar to a preview frame in a digital camera) for the shooting target in the current image; if satisfactory to the image within the framing frame, photographing is performed. Therefore, before the framing frame is set, an image containing a shooting target exists in the visual field of the shooting part, and if a scene is dense with multiple persons, the image may contain a cosome, and the contour information of all persons in the image can be obtained. Optionally, before the photographing composition, the outline information of all persons in the image is identified and calculated at one time (or output by a previous-stage module of the photographing composition), and is stored. Therefore, when the shooting target is adjusted, for example, a cosome is added, the contour information of the cosome does not need to be re-identified and calculated, the contour information of the new shooting target can be obtained according to the stored contour information of the shooting target and the contour information of the cosome, and then the initial framing frame of the new shooting target is further obtained. Certainly, the contour information of the shooting target can be acquired firstly during shooting and composition, and then the contour information of the relevant accompany body is identified and calculated when needed; the former method is adopted in the present embodiment.
In the embodiment, in a scene with dense people, the shooting target is dynamically adjusted, so that the composition with uncertain people number and uncertain actions is adaptively realized. Although the composition method of the present embodiment is described with the object as a person, it is obvious that the method is also applicable to an object with a clear outline such as an animal, a plant, or a building, and the method is general and will not be repeated.
In another embodiment of the present invention, as shown in fig. 2, an automatic photography composition method includes:
step S100 acquires contour information of a photographic subject.
Step S210 is to establish an outer envelope frame of the shooting target according to the outline information.
The contour information is human body contour information which comprises head frame coordinates, body frame coordinates and joint point coordinates of the shooting target. The step of establishing an outer envelope frame of the shooting target according to the outline information comprises the following steps: taking the minimum value of the head frame coordinate, the body frame coordinate and the x coordinate value in each joint point coordinate of the shooting target as a left x coordinate value; taking the maximum value of the head frame coordinate, the body frame coordinate and the x coordinate value in each joint point coordinate of the shooting target as a right x coordinate value; taking the minimum value of the head frame coordinate, the body frame coordinate and the y coordinate value in each joint point coordinate of the shooting target as a lower y coordinate value; taking the maximum value of the head frame coordinate, the body frame coordinate and the y coordinate value in each joint point coordinate of the shooting target as an upper y coordinate value; obtaining a left upper corner coordinate and a right lower corner coordinate according to the left side x coordinate value, the right side x coordinate value, the lower side y coordinate value and the upper side y coordinate value, and determining an outer envelope frame of the shooting target according to the left upper corner coordinate and the right lower corner coordinate; or obtaining a lower left corner coordinate and an upper right corner coordinate according to the left side x coordinate value, the right side x coordinate value, the lower side y coordinate value and the upper side y coordinate value, and determining an outer envelope frame of the shooting target according to the lower left corner coordinate and the upper right corner coordinate.
Step S220 is to generate an initial frame structure according to the outer envelope frame, wherein the initial frame structure comprises the outer envelope frame and is concentric with the outer envelope frame.
Specifically, before composition is started, contour information of a shooting target is acquired, for example, coordinates of an upper left point and a lower right point of a head frame, coordinates of an upper left point and a lower right point of a Body frame, and coordinates of each joint point; and obtaining an outer envelope frame (a rectangular frame for short) of the shooting target according to the coordinates of each point. Specifically, the minimum value of the x coordinates of all points is taken as the x coordinate value x of the left sideminTaking the maximum value of x coordinates of all points as the right x coordinate value xmaxTaking the minimum value of all points y coordinate as the lower y coordinate value yminTaking the maximum value of the y coordinates of all points as the y coordinate value y of the upper edgemaxSo as to obtain the coordinate of the upper left corner of the figure box as (x)min,ymax) The coordinate of the lower right corner is (x)max,ymin) The coordinate of the lower left corner is (x)min,ymin) The coordinate of the upper right corner is (x)max,ymax) The figure frame can be determined according to the coordinates of the upper left corner and the lower right corner, and the figure frame can also be determined according to the coordinates of the lower left corner and the upper right corner. As an example, as shown in fig. 6, the figure frame 2 is a minimum rectangular frame completely surrounding the head, body, and joint points of the character. Optionally, according to the photographing requirement, for example, only the upper half of the person needs to be photographed, if an outer envelope of the overall outline information is established, the upper half can be cut from the outer envelope as the required outer envelope.
The center of the outer envelope frame is the center of the initial frame, and a rectangular frame (namely the initial frame) completely containing the outer envelope frame is obtained according to a preset photographing aspect ratio.
Specifically, for example, the height of the outer envelope frame is not changed (that is, the height of the initial framing frame is equal to the height of the outer envelope frame), the width of the initial framing frame is calculated according to a preset photographing aspect ratio, and if the width of the initial framing frame is greater than or equal to the width of the outer envelope frame, the side length corresponding to the width of the outer envelope frame is symmetrically extended to the width of the initial framing frame to obtain the initial framing frame; otherwise, according to the width of the outer envelope frame unchanged (namely the width of the initial frame is equal to the width of the outer envelope frame), calculating the height of the initial frame according to a preset shooting width-height ratio, and symmetrically extending the side length corresponding to the height of the outer envelope frame to the height of the initial frame to obtain the initial frame.
Preferably, the width ratio and the height ratio are respectively calculated according to the width and the height of the outer envelope frame and a preset shooting width-height ratio; comparing the width ratio and the height ratio; when the height ratio is larger than the width ratio, calculating the width of an initial framing frame according to the height of the outer envelope frame and the photographic width-height ratio, keeping the height of the outer envelope frame unchanged, symmetrically extending the width of the outer envelope frame to the width of the initial framing frame, and obtaining a rectangular frame as the initial framing frame; and when the height ratio is not greater than the width ratio, calculating the height of the initial framing frame according to the width of the outer envelope frame and the photographic width-height ratio, keeping the width of the outer envelope frame unchanged, symmetrically extending the height of the outer envelope frame to the height of the initial framing frame, and obtaining the rectangular frame as the initial framing frame. For example, if the width of an outer frame is 0.4 and the height is 0.8, the preset aspect ratio is 3:2 (indicating that the camera is imaging according to 3: 2), the width ratio (the ratio of the corresponding widths) is calculated to be 0.1333 (0.4/3), and the height ratio (the ratio of the corresponding heights) is 0.4 (0.8/2), where the height ratio is greater than the width ratio, and in order to ensure that the content in the outer frame is not cut off, the height of the outer frame is selected to be kept unchanged, the width of the initial frame is calculated to be 1.2 (0.8/2) to obtain the width of the initial frame being 1.2 and the height being 0.8; and symmetrically extending the width of the outer envelope frame to the width of the initial frame, wherein the obtained rectangular frame is the initial frame.
Step S300 determines whether there are cosubes in the initial framing frame, where the cosubes are other objects that can be photographed.
In step S400, when there is no cosome in the initial frame, the initial frame is output as a target frame.
Step S510, when an accompanying body exists in the initial composition frame, judging whether the accompanying body is also required to be used as a shooting target;
step S520, when at least two cosomes exist in the initial composition frame, respectively judging whether each cosome is also required to be taken as a shooting target;
the judging step of whether each partner must also be the shooting target is as follows:
calculating the overlapping area of the cosome and the initial framing frame, and calculating the proportion of the overlapping area to the whole area of the cosome;
judging whether the proportion is greater than or equal to a preset value; when the proportion is larger than or equal to a preset value, the accompany body must also be taken as a shooting target; and when the proportion is smaller than a preset value, the accompany body is not taken as a shooting target.
Step S530 determines whether there is a companion that must also be a photographic target.
Specifically, when a plurality of cosubs exist in the initial frame, each cosubs is determined, and which cosubs are not taken as the shooting target and which must be taken as the shooting target. And judging whether a partner exists and must be used as a shooting target according to the judgment result of each partner.
The judgment method of each accompany body is the same, and comprises the following steps: and calculating the overlapping area of the cosome and the initial framing frame, and calculating the proportion of the area to the whole area of the cosome. When the proportion is larger than or equal to a preset value, the accompany body must also be taken as a shooting target; otherwise, the partner is not a photographic target. As shown in fig. 7, the left diagram is an example in which a cosome must also be a photographic subject, and the right diagram is an example in which a cosome is not a photographic subject.
In step S610, when there are cosubjects in the initial composition frame and all the cosubjects are not taken as the shooting targets, the initial composition frame is moved to obtain a composition frame with the minimum influence of the cosubjects as a target composition frame, and the target composition frame is output.
Specifically, when the initial composition frame has the cosome and all the cosomes are not taken as the shooting targets, the initial composition frame is moved once or for multiple times to regenerate a plurality of new composition frames, and the effective composition frame with the minimum cosome influence degree is selected from the obtained new composition frames and the initial composition frames to be output as the target composition frame. The effective frame is a frame including an outer envelope of the object.
The initial framing frame may be attempted to be translated in one or more combinations selected from the 4 directions up, down, left, and right. Further, when the height of the initial framing frame is greater than the height of the outer envelope frame, an upward or downward movement may be performed. When the width of the initial framing frame is greater than the width of the outer envelope frame, the left or right movement may be performed. Further, an appropriate moving direction is selected according to the relative position relationship between the cosome and the shooting target, and preferably, the initial frame is moved in a direction of moving out of the cosome, for example, as shown in fig. 8, the cosome is moved in a direction to the left on the right side of the initial frame.
Alternatively, when only one cosome is in the initial frame, the cosome is set as the reference cosome. When a plurality of cosubs exist in the initial frame, one cosubs is selected as a reference cosubs. And moving the initial frame structure once according to a preset step along the direction of moving out the reference cosome to obtain a new frame structure. And judging whether the new frame is a valid frame (namely, the frame completely comprises the outer envelope frame of the shooting target). And if the frame is not the effective frame, outputting the initial frame as the target frame. If the frame is a valid frame, the cosome influence degree of the new frame is further calculated and compared with the cosome influence degree of the initial frame. And if the influence degree of the cosome is smaller, outputting the new frame as a target frame.
By judging whether the new frame is an effective frame, the output target frame is ensured to be an effective frame without the situations of hand interception, foot interception and the like.
Further, an effective composition frame with the minimum influence degree of the cosome in a certain direction is obtained through multiple continuous translations, and the effective composition frame is output as a target composition frame. Specifically, for example, when there is only one cosome in the initial frame, the cosome is set as the reference cosome. When a plurality of cosubs exist in the initial frame, one cosubs is selected as a reference cosubs. And moving the initial frame structure once according to a preset step along the direction of moving out the reference cosome to obtain a first new frame structure. And when the first new frame is an effective frame and the influence of the cosome is smaller, continuously moving along the original direction to obtain a second new frame, judging the influence and effectiveness of the cosome of the second new frame, and repeating the steps until the influence of the cosome of the Nth new frame is larger than that of the previous frame or the Nth new frame is not the effective frame. And outputting the N-1 th new frame structure frame as a target frame structure frame. Through the mode, the effective picture frame with the minimum effect of the cosome in a certain direction can be obtained, the effect of the cosome is further reduced, and the picture composition quality is improved.
Further, when a plurality of cosomes exist in the initial frame, selecting one cosome as a reference cosome, continuously moving the initial frame along the direction of moving out the reference cosome, and obtaining an effective frame with the minimum influence degree of the cosome in the direction according to the method and marking the effective frame as a frame candidate; selecting another cosome as a reference cosome, and repeating the method to obtain another corresponding frame candidate; thus, the frame candidate frame in each cosome moving-out direction is obtained, and the frame candidate frame with the minimum cosome influence degree is selected from the frame candidates and is output as the target frame. For example, two cosets (a coset 1 and a coset 2, the coset 1 is on the right side of the shooting target, and the coset 2 is on the left side of the shooting target), according to the above method, the initial frame structure is continuously translated along the direction (i.e. to the left) of moving out the coset 1, and an effective frame structure with the minimum coset influence degree in the direction is obtained and is marked as a frame candidate 1. Then, according to the above method, the initial frame structure is continuously translated along the direction of moving out the cosome 2 (i.e. to the right), and an effective frame structure with the minimum cosome influence degree in the direction is obtained, which is the candidate frame structure 2. And comparing the volume of influence of the candidate frame 1 and the candidate frame 2, and selecting the frame with the minimum volume of influence as the target frame to be output, so that the influence of the volume of influence of the candidate frame is further reduced, and the composition quality is improved.
Factors for evaluating the influence of the cosome include the overlapping area of the picture frame and the cosome and/or the number of cosome overlapping the picture frame. For example, the volume of the cosome is estimated according to the overlapping area of the framing frame and the cosome, and the smaller the overlapping area is, the lower the volume of the cosome is; the overlapping area is 0 and the volume of the cosome is 0, so that the frame with the smallest overlapping area between the frame and the cosome is selected. For another example, the influence degree of the frame is estimated according to the number of the frame overlapping the composition frame and the overlapping area of the frame and the frame, and further, the frame with the smaller number of the frame and the smallest overlapping area of the frame and the frame can be prioritized under the same number of the frame.
Step S700, when a cosome exists in the initial composition frame and at least one cosome exists and must also be taken as a shooting target, forming a new shooting target by the cosome which must also be taken as the shooting target and the shooting target, replacing the shooting target with the new shooting target, and jumping to step S100.
In one embodiment of the present invention, as shown in fig. 3, an automatic photography composition apparatus 100 includes a contour information obtaining module 110, a composition frame generating module 120, a partner determining module 130, and a composition frame output module 140.
The contour information acquiring module 110 is configured to acquire contour information of a shooting target.
Specifically, the shooting target may be an adult or a child, and may be one or more characters, as needed. When the photographing target is a person, the contour information may include position information of the head, body, and each joint of the person, by which the contour of the person can be described. Because the invention further provides the service for the photography and composition of the outline information, the accurate information of the human body curve does not need to be obtained, and the outline information can be replaced by a closed geometric body with a slightly larger volume and simple characteristics, thereby reducing the data amount to be processed and the complexity of the calculation and photography. The contour information can be obtained by human body detection and key point detection technologies.
The composition frame generating module 120 is configured to generate an initial composition frame for the shooting target according to the contour information.
The framing frame is a closed frame with a certain shape and size, and is used for limiting the shape and size of a photographic picture. Generally, the framing frame is a rectangular frame.
In order to avoid the phenomenon that the integrity of a person is damaged by cropping or cutting limbs of a shooting target in a picture or an image output by shooting, a framing frame needs to be generated according to the outline information of the shooting target. Optionally, according to the photographing requirement, for example, only the upper half of the person needs to be photographed, the upper half information of the photographing target is extracted from the outline information, and the composition frame only contains the upper half information of the photographing target; if there is no special imaging request, the composition frame is required to include the entire outline information of the imaging target, in general, in order to ensure the integrity of the entire person.
In addition, in order to highlight the photographing object and improve the photographing quality, the photographing object generally needs to be placed at the central region of the composition frame. As a preferred embodiment, an outer envelope of the shot object is obtained according to the contour information, optionally taking the shooting requirements into consideration; and taking the center of the outer envelope frame as the center of the composition frame, and obtaining a rectangular frame completely containing the outer envelope frame of the shooting target according to a preset shooting aspect ratio, so as to obtain an ideal composition frame which at least accords with the composition rule of a preset position and the composition rule of a preset size.
The framed frame obtained according to the contour information of the object is called an initial framed frame.
The cosome determining module 130 is configured to determine whether a cosome exists in the initial frame, where the cosome is another object that can be photographed.
The cosome refers to other photographable objects similar to the photographic object. In order to improve the shooting quality of the shooting target, it is necessary to determine whether there is a cosome or a part of the cosome in the initial frame (i.e., there is an overlap between the initial frame and the cosome). There may be no cosome, one cosome, or multiple cosomes within the initial framing frame.
The composition frame output module 140 is configured to output the initial composition frame as a target composition frame when no accompany body exists in the initial composition frame.
The partner determining module 130 is further configured to determine whether there is a partner that must also be a photographic target when there is a partner in the initial composition frame.
Specifically, when a cosome exists in the initial frame, the influence of the cosome needs to be considered. The method comprises the steps of obtaining an initial frame, wherein the initial frame may have one or more cosome, respectively judging whether each cosome is also required to be used as a shooting target, and obtaining whether one cosome which is also required to be used as the shooting target exists according to the judgment result of each cosome. The judging means of each accompany body can be as follows: and calculating the overlapping area of the cosome and the initial framing frame, wherein if the overlapping area is larger than a preset value, the cosome must also be used as a shooting target. Preferably, the overlapping area of each cosome and the initial skeleton frame is calculated, and the proportion of the area to the whole area of the cosome is calculated. When the proportion is larger than or equal to a preset value, the accompany body must also be taken as a shooting target; otherwise, the partner is not a photographic target.
The composition frame generation module 120 is further configured to, when there are cosubjects in the initial composition frame and all the cosubjects are not taken as shooting targets, regenerate a composition frame with an influence degree of the cosubjects not greater than that of the current composition frame and output the composition frame as a target composition frame.
Specifically, when the cosome exists in the initial frame, if all the cosomes are not taken as the shooting targets, it is shown that all the cosomes have little influence on the initial frame. This situation can further improve the quality of the shot by regenerating a framed frame with a smaller volume of the cosome influence than the current framed frame. The influence degree of the cosome reflects the influence of the cosome on the framed frame, for example, the cosome is judged by the overlapping area of the cosome and the framed frame or the proportion of the overlapping area to the cosome.
In some cases, a framed frame with a smaller degree of influence of the accompanying object may not be obtained again compared to the initial framed frame, but because the influence of the accompanying object is small, even if the initial framed frame is output, the accompanying object can be prevented from existing in the actual picture by, for example, cutting the picture after photographing. Further, when a plurality of frame frames with smaller influence degrees of the cosome exist, the frame with the smallest influence degree of the cosome is selected from the frame frames and is output as the target frame.
The cosome determining module 130 is further configured to, when a cosome exists in the initial composition frame and at least one cosome exists and must also serve as a shooting target, form a new shooting target with the cosome that must also serve as the shooting target and the shooting target, and replace the shooting target with the new shooting target to regenerate the target composition frame.
Specifically, when an accompanying body exists in the initial frame construction frame and the accompanying body needs to be brought into a shooting target, the accompanying body and the shooting target are combined to obtain a new shooting target, the new shooting target is used for replacing the shooting target, the outline information of the shooting target is obtained again, and a new round of generation and output process of the target frame construction frame is started. When a plurality of cosubs exist in the initial frame construction, and part or all of the cosubs are necessary to be taken as the shooting targets, all the cosubs which are necessary to be taken as the shooting targets are combined with the shooting targets to obtain new shooting targets, the new shooting targets are used for replacing the shooting targets, and the generation and output processes of a new round of target frame construction are restarted.
In the embodiment, in a scene with dense people, the shooting target is dynamically adjusted, so that the composition with uncertain people number and uncertain actions is adaptively realized. Although the present embodiment has been described with the imaging target being a person, it is obvious that the imaging target is also a clearly outlined object such as an animal, a plant, or a building, and therefore, the description thereof is not repeated.
In another embodiment of the present invention, as shown in FIG. 3, an automatic photography patterning device 100, comprises:
and a contour information acquiring module 110 for acquiring contour information of the shooting target.
The composition frame generating module 120 is configured to establish an outer envelope frame of the shooting target according to the contour information; and generating an initial frame structure according to the outer envelope frame, wherein the initial frame structure comprises the outer envelope frame and is concentric with the outer envelope frame.
The contour information is human body contour information which comprises head frame coordinates, body frame coordinates and joint point coordinates of the shooting target. The outer enveloping frame for establishing the shooting target according to the contour information comprises: taking the minimum value of the head frame coordinate, the body frame coordinate and the x coordinate value in each joint point coordinate of the shooting target as a left x coordinate value; taking the maximum value of the head frame coordinate, the body frame coordinate and the x coordinate value in each joint point coordinate of the shooting target as a right x coordinate value; taking the minimum value of the head frame coordinate, the body frame coordinate and the y coordinate value in each joint point coordinate of the shooting target as a lower y coordinate value; taking the maximum value of the head frame coordinate, the body frame coordinate and the y coordinate value in each joint point coordinate of the shooting target as an upper y coordinate value; obtaining a left upper corner coordinate and a right lower corner coordinate according to the left side x coordinate value, the right side x coordinate value, the lower side y coordinate value and the upper side y coordinate value, and determining an outer envelope frame of the shooting target according to the left upper corner coordinate and the right lower corner coordinate; or obtaining a lower left corner coordinate and an upper right corner coordinate according to the left side x coordinate value, the right side x coordinate value, the lower side y coordinate value and the upper side y coordinate value, and determining an outer envelope frame of the shooting target according to the lower left corner coordinate and the upper right corner coordinate.
The center of the outer envelope frame is the center of the initial frame, and a rectangular frame (namely the initial frame) completely containing the outer envelope frame is obtained according to a preset photographing aspect ratio.
Preferably, the width ratio and the height ratio are respectively calculated according to the width and the height of the outer envelope frame and a preset shooting width-height ratio; comparing the width ratio and the height ratio; when the height ratio is larger than the width ratio, calculating the width of an initial framing frame according to the height of the outer envelope frame and the photographic width-height ratio, keeping the height of the outer envelope frame unchanged, symmetrically extending the width of the outer envelope frame to the width of the initial framing frame, and obtaining a rectangular frame as the initial framing frame; and when the height ratio is not greater than the width ratio, calculating the height of the initial framing frame according to the width of the outer envelope frame and the photographic width-height ratio, keeping the width of the outer envelope frame unchanged, symmetrically extending the height of the outer envelope frame to the height of the initial framing frame, and obtaining the rectangular frame as the initial framing frame.
And an accompanying body judging module 130, configured to judge whether an accompanying body exists in the initial frame, where the accompanying body is another object that can be photographed.
And a composition frame output module 140, configured to output the initial composition frame as a target composition frame when no accompany body exists in the initial composition frame.
The partner determining module 130 is further configured to determine whether a partner is also required to be a shooting target when the partner exists in the initial composition frame; when at least two cosomes exist in the initial composition frame, respectively judging whether each cosome must also be taken as a shooting target; it is judged whether or not there is a companion which must also be a photographic subject.
The judging step of whether each partner must also be the shooting target is as follows: when a cosome exists in the initial composition frame, calculating the overlapping area of the cosome and the initial composition frame, and calculating the proportion of the overlapping area to the whole area of the cosome; judging whether the proportion is greater than or equal to a preset value; when the proportion is larger than or equal to a preset value, the accompany body must also be taken as a shooting target; and when the proportion is smaller than a preset value, the accompany body is not taken as a shooting target.
Specifically, when a plurality of cosubs exist in the initial frame, each cosubs is determined, and which cosubs are not taken as the shooting target and which must be taken as the shooting target. And judging whether a partner exists and must be used as a shooting target according to the judgment result of each partner.
The judgment method of each accompany body is the same, and comprises the following steps: and calculating the overlapping area of the cosome and the initial framing frame, and calculating the proportion of the area to the whole area of the cosome. When the proportion is larger than or equal to a preset value, the accompany body must also be taken as a shooting target; otherwise, the partner is not a photographic target.
The composition frame generation module 120 is further configured to, when there are cosubjects in the initial composition frame and all the cosubjects are not taken as shooting targets, move the initial composition frame to obtain a composition frame with the minimum influence of the cosubjects as a target composition frame, and output the target composition frame.
Specifically, when the initial composition frame has the cosome and all the cosomes are not taken as the shooting targets, the initial composition frame is moved once or for multiple times to regenerate a plurality of new composition frames, and the effective composition frame with the minimum cosome influence degree is selected from the obtained new composition frames and the initial composition frames to be output as the target composition frame. The effective frame is a frame including an outer envelope of the object.
The initial framing frame may be attempted to be translated in one or more combinations selected from the 4 directions up, down, left, and right. Further, when the height of the initial framing frame is greater than the height of the outer envelope frame, an upward or downward movement may be performed. When the width of the initial framing frame is greater than the width of the outer envelope frame, the left or right movement may be performed. Further, an appropriate moving direction is selected according to the relative position relationship between the cosome and the shooting target, and preferably, the initial framing frame is moved in the direction of moving out of the cosome.
Alternatively, when only one cosome is in the initial frame, the cosome is set as the reference cosome. When a plurality of cosubs exist in the initial frame, one cosubs is selected as a reference cosubs. And moving the initial frame structure once according to a preset step along the direction of moving out the reference cosome to obtain a new frame structure. And judging whether the new frame is a valid frame (namely, the frame completely comprises the outer envelope frame of the shooting target). And if the frame is not the effective frame, outputting the initial frame as the target frame. If the frame is a valid frame, the cosome influence degree of the new frame is further calculated and compared with the cosome influence degree of the initial frame. And if the influence degree of the cosome is smaller, outputting the new frame as a target frame.
By judging whether the new frame is an effective frame, the output target frame is ensured to be an effective frame without the situations of hand interception, foot interception and the like.
Further, an effective composition frame with the minimum influence degree of the cosome in a certain direction is obtained through multiple continuous translations, and the effective composition frame is output as a target composition frame. Specifically, for example, when there is only one cosome in the initial frame, the cosome is set as the reference cosome. When a plurality of cosubs exist in the initial frame, one cosubs is selected as a reference cosubs. And moving the initial frame structure once according to a preset step along the direction of moving out the reference cosome to obtain a first new frame structure. And when the first new frame is an effective frame and the influence of the cosome is smaller, continuously moving along the original direction to obtain a second new frame, judging the influence and effectiveness of the cosome of the second new frame, and repeating the steps until the influence of the cosome of the Nth new frame is larger than that of the previous frame or the Nth new frame is not the effective frame. And outputting the N-1 th new frame structure frame as a target frame structure frame. Through the mode, the effective picture frame with the minimum effect of the cosome in a certain direction can be obtained, the effect of the cosome is further reduced, and the picture composition quality is improved.
Further, when a plurality of cosomes exist in the initial frame, selecting one cosome as a reference cosome, continuously moving the initial frame along the direction of moving out the reference cosome, and obtaining an effective frame with the minimum influence degree of the cosome in the direction according to the method and marking the effective frame as a frame candidate; selecting another cosome as a reference cosome, and repeating the method to obtain another corresponding frame candidate; thus, the frame candidate frame in each cosome moving-out direction is obtained, and the frame candidate frame with the minimum cosome influence degree is selected from the frame candidates and is output as the target frame.
Factors for evaluating the influence of the cosome include the overlapping area of the picture frame and the cosome and/or the number of cosome overlapping the picture frame.
The cosome determining module 130 is further configured to, when a cosome exists in the initial composition frame and at least one cosome exists and must also serve as a shooting target, form a new shooting target with the cosome that must also serve as the shooting target and the shooting target, and replace the shooting target with the new shooting target to regenerate the target composition frame.
It should be noted that the embodiment of the automatic photographing and composition apparatus provided by the present invention and the embodiment of the automatic photographing and composition method provided by the foregoing embodiments are all based on the same inventive concept, and can achieve the same technical effects. Accordingly, other specific contents of the embodiment of the automatic photography and composition apparatus can refer to the description of the embodiment contents of the automatic photography and composition method described above.
In one embodiment of the present invention, as shown in fig. 4, an electronic device 400 includes a memory 410 and a processor 420. The memory 410 is used to store a computer program 430. The processor, when running the computer program, implements the automatic photography composition method as described above.
As an example, the processor 420, when executing the computer program, implements steps S100 to S700 according to the foregoing description. The processor 420 implements the functions of the modules and units of the automatic photography/patterning device 100 described above when executing the computer program. As yet another example, the processor 420, when executing the computer program, implements the functions of the outline information acquisition module 110, the composition frame generation module 120, the satellite determination module 130, and the composition frame output module 140.
Alternatively, the computer program may be divided into one or more modules/units according to the particular needs to accomplish the invention. Each module/unit may be a series of computer program instruction segments capable of performing a particular function. The computer program instruction segments are used to describe the execution of the computer program in the automated photographic patterning device 100. As an example, the computer program may be divided into respective modules/units in a virtual device, such as a contour information acquisition module, a composition frame generation module, a satellite determination module, and a composition frame output module.
The processor is configured to implement automatic photography composition by executing the computer program. The processor may be a Central Processing Unit (CPU), Graphics Processing Unit (GPU), Digital Signal Processor (DSP), Application Specific Integrated Circuit (ASIC), Field Programmable Gate Array (FPGA), general purpose processor or other logic device, etc., as desired.
The memory may be any internal storage unit and/or external storage device capable of storing data and programs, such as a plug-in hard disk, a smart card (SMC), a Secure Digital (SD) card, a flash memory card, and the like. The memory is used to store computer programs, other programs for the automatic photo-patterning device 100, and data.
The electronic device 400 may be any computer device, such as a desktop computer (desktop), a laptop computer (laptop), a Personal Digital Assistant (PDA), or a server (server). The electronic apparatus 400 may further include an input/output device, a display device, a network access device, a bus 440, and the like, as required. The electronic device 400 may also be a single chip computer or a computing device integrating a Central Processing Unit (CPU) and a Graphics Processing Unit (GPU).
It will be understood by those skilled in the art that the above-mentioned units and modules for implementing the corresponding functions are divided for the purpose of convenient illustration and description, and the above-mentioned units and modules are further divided or combined according to the application requirements, that is, the internal structures of the devices/apparatuses are divided and combined again to implement the above-mentioned functions. Each unit and module in the above embodiments may be separate physical units, or two or more units and modules may be integrated into one physical unit. The units and modules in the above embodiments may implement corresponding functions by using hardware and/or software functional units. Direct coupling, indirect coupling or communication connection among a plurality of units, components and modules in the above embodiments can be realized through a bus or an interface; the coupling, connection, etc. between the multiple units or devices may be electrical, mechanical, or the like. Accordingly, the specific names of the units and modules in the above embodiments are only for convenience of description and distinction, and do not limit the scope of protection of the present application.
In one embodiment of the present invention, a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, can implement the automatic photography composition method as recited in the preceding embodiments. That is, when part or all of the technical solutions of the embodiments of the present invention contributing to the prior art are embodied by means of a computer software product, the computer software product is stored in a computer-readable storage medium. The computer readable storage medium may be any portable computer program code entity apparatus or device, such as a U disk, a removable magnetic disk, a magnetic disk, an optical disk, a computer memory, a read-only memory, a RAM, etc.
In one embodiment of the present invention, as shown in fig. 5, an automatic photographing apparatus 500 includes:
the automatic photography patterning device 100 according to any of the above embodiments is used to output a target framing frame.
A photographing unit 502 for performing a photographing operation when the target framing frame is received. The photographing part 502 is used to fix optical image photographing on a corresponding storage medium. Alternatively, the photographing part 502 may be a digital camera, so that an optical image can be converted into data to be stored. The image capturing means such as the image capturing means 502 may be a technique known to those skilled in the art.
It should be noted that the above embodiments can be freely combined as necessary. The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.