WO2021147650A1 - 拍照方法、装置、存储介质及电子设备 - Google Patents
拍照方法、装置、存储介质及电子设备 Download PDFInfo
- Publication number
- WO2021147650A1 WO2021147650A1 PCT/CN2020/142422 CN2020142422W WO2021147650A1 WO 2021147650 A1 WO2021147650 A1 WO 2021147650A1 CN 2020142422 W CN2020142422 W CN 2020142422W WO 2021147650 A1 WO2021147650 A1 WO 2021147650A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- human body
- key point
- composition
- electronic device
- key points
- Prior art date
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/64—Computer-aided capture of images, e.g. transfer from script file into camera, check of taken image quality, advice or proposal for image composition or decision on when to take image
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/61—Control of cameras or camera modules based on recognised objects
- H04N23/611—Control of cameras or camera modules based on recognised objects where the recognised objects include parts of the human body
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/62—Control of parameters via user interfaces
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/26—Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
- G06V10/267—Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion by performing operations on regions, e.g. growing, shrinking or watersheds
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/46—Descriptors for shape, contour or point-related descriptors, e.g. scale invariant feature transform [SIFT] or bags of words [BoW]; Salient regional features
- G06V10/462—Salient features, e.g. scale invariant feature transforms [SIFT]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/56—Extraction of image or video features relating to colour
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V40/00—Recognition of biometric, human-related or animal-related patterns in image or video data
- G06V40/10—Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/63—Control of cameras or camera modules by using electronic viewfinders
- H04N23/631—Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters
- H04N23/632—Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters for displaying or modifying preview images prior to image capturing, e.g. variety of image resolutions or capturing parameters
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/63—Control of cameras or camera modules by using electronic viewfinders
- H04N23/633—Control of cameras or camera modules by using electronic viewfinders for displaying additional information relating to control or operation of the camera
Definitions
- This application belongs to the field of electronic technology, and in particular relates to a photographing method, device, storage medium, and electronic equipment.
- the embodiments of the present application provide a photographing method, device, storage medium, and electronic equipment, which can improve image quality.
- an embodiment of the present application provides a photographing method applied to an electronic device, including:
- the shooting scene is photographed to obtain the target image.
- an embodiment of the present application provides a photographing device applied to electronic equipment, including:
- the detection module is used to detect the key points of the human body in the shooting scene to obtain a set of human body key points of the human body;
- a determining module configured to determine a set of composition key points corresponding to the shooting scene
- a generating module for generating and outputting prompt information for adjusting the posture of the electronic device when the set of key points of the human body does not match the set of key points of the composition
- the shooting module is used for shooting the shooting scene to obtain the target image when the real-time human body key point set of the human body matches the composition key point set.
- an embodiment of the present application provides a storage medium on which a computer program is stored.
- the computer program is executed on a computer, the computer is caused to execute the process in the photographing method provided by the embodiment of the present application.
- an embodiment of the present application also provides an electronic device, including a memory and a processor, and the processor is used to execute the process in the photographing method provided in the embodiment of the present application by calling a computer program stored in the memory. .
- FIG. 1 is a schematic diagram of the first process of a photographing method provided by an embodiment of the present application.
- FIG. 2 is a schematic diagram of the second process of the photographing method provided by an embodiment of the present application.
- FIG. 3 is a schematic diagram of a preview image G1 provided by an embodiment of the present application.
- FIG. 4 is a schematic diagram of a human body boundary box B1 provided by an embodiment of the present application.
- Fig. 5 is a schematic diagram of a human body image G2 provided by an embodiment of the present application.
- Fig. 6 is a schematic diagram of prompt information provided by an embodiment of the present application.
- FIG. 7 is a schematic diagram of a target image G3 provided by an embodiment of the present application.
- Fig. 8 is a schematic structural diagram of a photographing device provided by an embodiment of the present application.
- FIG. 9 is a schematic diagram of the first structure of an electronic device provided by an embodiment of the present application.
- FIG. 10 is a schematic diagram of a second structure of an electronic device provided by an embodiment of the present application.
- FIG. 11 is a schematic diagram of the structure of an image processing circuit provided by an embodiment of the present application.
- the embodiment of the application provides a photographing method, which is applied to an electronic device, and includes:
- the shooting scene is photographed to obtain the target image.
- the detecting the key points of the human body in the shooting scene to obtain the set of key points of the human body includes:
- a key point detection model is used to perform key point detection on the human body image to obtain a human body key point set of the human body.
- the determining a set of composition key points corresponding to the shooting scene includes:
- the candidate key point set corresponding to the human body type among the plurality of candidate key point sets is determined as the composition key point set corresponding to the shooting scene.
- the method further includes:
- the method further includes:
- the mismatch between the set of human body key points and the set of composition key points includes: the average distance is greater than or equal to a preset average distance.
- the generating and outputting prompt information for adjusting the posture of the electronic device includes:
- the method further includes:
- the mismatch between the set of human body key points and the set of composition key points includes: the set of human face key points does not match the set of target composition key points.
- the method further includes:
- the mismatch between the set of human face key points and the set of target composition key points includes: the first distance is greater than or equal to a first preset distance.
- the method further includes:
- the mismatch between the set of human body key points and the set of composition key points includes: the second distance is greater than or equal to a second preset distance.
- the method further includes:
- the mismatch between the set of human body key points and the set of composition key points includes: the third distance is greater than or equal to a third preset distance.
- the execution subject of the embodiments of the present application may be an electronic device such as a smart phone or a tablet computer.
- FIG. 1 is a schematic diagram of the first process of a photographing method provided by an embodiment of the present application.
- the photographing method may be applied to an electronic device.
- the process may include:
- the key point detection of the human body in the shooting scene is performed to obtain the human body key point set of the human body.
- the electronic device can obtain a preview image of the shooting scene. Subsequently, the electronic device can determine the human body bounding box from the preview image. Then, the electronic device can cut out the human body image from the preview image based on the human body bounding box. Finally, the electronic device can perform key point detection on the human body image to obtain a set of human body key points of the human body in the shooting scene.
- the set of key points of the human body can include: nose, left eye, right eye, left ear, right ear, neck, left shoulder, right shoulder, left elbow, right elbow, left wrist, right wrist, left hip, right hip, left knee , Right knee, left ankle, right ankle and other key points of the human body.
- the scene to which the camera of the electronic device is aimed is the shooting scene.
- the shooting scene does not specifically refer to a specific scene, but a scene that is aligned in real time following the direction of the camera.
- a set of composition key points corresponding to the shooting scene is determined.
- a plurality of different candidate key point sets with reasonable composition are preset in the electronic device.
- the candidate key point set can correspond to the background image.
- one background image can correspond to multiple candidate key point sets.
- Each set of candidate key points can include: nose, left eye, right eye, left ear, right ear, neck, left shoulder, right shoulder, left elbow, right elbow, left wrist, right wrist, left hip, right hip, left knee , Right knee, left ankle, right ankle, and other candidate key points.
- the electronic device may divide the preview image of the shooting scene into a foreground image and a background image. After that, the electronic device may obtain multiple candidate key point sets corresponding to the background image, and determine one of the multiple candidate key point sets as a composition key point set corresponding to the shooting scene.
- the foreground image may be an image containing a "person", an image containing an animal “cat”, an image containing an animal “dog”, or the like.
- the background image may be a "mountain view” image, a "water view” image, a “seascape” image, a "snow view” image, and so on.
- the composition key point set corresponding to the shooting scene may be a candidate key point set that is the same as or similar to the human body key point set among the multiple candidate key point sets corresponding to the background image.
- the set of key points of the human body includes 8 key points: nose, left eye, right eye, left ear, right ear, neck, left shoulder, and right shoulder. If there is a candidate key point set in the multiple candidate key point sets corresponding to the background image of the shooting scene, it only includes the 8 key points of nose, left eye, right eye, left ear, right ear, neck, left shoulder, and right shoulder.
- the electronic device may determine that the candidate key point set is the same as the human body key point set, and the electronic device may determine the candidate key point set as the composition key point set corresponding to the shooting scene. If there is a candidate key point set in the multiple candidate key point sets, it also includes the 8 key points of nose, left eye, right eye, left ear, right ear, neck, left shoulder, and right shoulder, as well as other key points, If the two key points of the left elbow and the right elbow are also included, the electronic device may determine that the candidate key point set is similar to the human body key point set, and the electronic device may also determine the candidate key point set as the composition corresponding to the shooting scene Key points collection.
- the electronic device can determine whether the human body key point set matches the composition key point set. If the human body key point set does not match the composition key point set, the electronic device can generate and output prompt information for adjusting the posture of the electronic device, so that the real-time human body key point set of the human body matches the composition key point set.
- the shooting scene also changes continuously.
- the key points of the human body in the shooting scene are detected, and the positions of the human body key points in the obtained human body key point set will also continue to change.
- the key points of the human body in the constantly changing position are the real-time human body key points, and the set of real-time human body key points is the real-time human body key point set.
- the electronic device can calculate the distance between each human body key point and the corresponding composition key point to obtain multiple distances; subsequently, the electronic device can calculate multiple The average distance of the distance; when the average distance is greater than or equal to the preset average distance, the electronic device determines that the set of key points of the human body does not match the set of key points of the composition.
- the human body key point is the nose
- the corresponding composition key point is also the nose
- the human body key point is the left shoulder
- the corresponding composition key point is also the left shoulder.
- the electronic device when judging whether the human body key point set matches the composition key point set, can also determine the face key point set from the human body key point set, and determine the key point set with the face from the composition key point set. The key point set of the target composition corresponding to the point set. When the face key point set does not match the target composition key point set, the electronic device can determine that the human body key point set does not match the composition key point set.
- the electronic device when judging whether the human body key point set matches the composition key point set, can determine the mean value A1 of the abscissa and the mean value A2 of the ordinate of the multiple key points of the human body included in the human body key point set, and determine the composition The mean value A3 of the abscissa and the mean value A4 of the ordinate of the plurality of composition key points included in the key point set. Subsequently, the electronic device can determine the first coordinate according to the average value A1 and the average value A2. The average value A1 can be used as the abscissa of the first coordinate, and the average value A2 can be used as the ordinate of the first coordinate.
- the electronic device can determine the second coordinate according to the average value A3 and the average value A4.
- the average value A3 can be used as the abscissa of the second coordinate
- the average value A4 can be used as the ordinate of the second coordinate.
- the electronic device can calculate the distance between the first coordinate and the second coordinate.
- the electronic device may determine that the set of key points of the human body does not match the set of key points of the composition.
- the abscissa and ordinate of the key points of the human body, the abscissa and the ordinate of the key points of the composition, the first coordinate and the second coordinate are all coordinates in the screen coordinate system.
- the electronic device when the real-time human body key point set of the human body matches the composition key point set, the electronic device can shoot the shooting scene to obtain an image that meets certain aesthetic rules, that is, the composition is reasonable. Or, when the real-time human body key point set of the human body matches the composition key point set, the electronic device may generate a prompt message to prompt the user to shoot the shooting scene. Then, the user can click the "shooting" button in the shooting application program interface to shoot the shooting scene and obtain a target image that meets certain aesthetic rules.
- the electronic device can directly shoot the shooting scene to obtain an image that meets certain aesthetic rules, that is, the composition is reasonable.
- the human body key point set of the human body in the shooting scene by acquiring the human body key point set of the human body in the shooting scene, and determining a composition key point set with a reasonable composition corresponding to the shooting scene, it can be confirmed when the human body key point set matches the composition key point set
- the preview image of the shooting scene has a reasonable composition.
- prompt information for adjusting the posture of the electronic device may be generated and output, so that the real-time preview image composition of the shooting scene is reasonable. Therefore, the composition of the image obtained by shooting the shooting scene can be made reasonable, and the quality of the image can be improved.
- detecting the key points of the human body in the shooting scene to obtain the set of key points of the human body includes:
- the electronic device may obtain a preview image of the shooting scene, and recognize objects in the preview image to confirm whether there is a single human body in the preview image.
- the electronic device may use a pre-trained portrait detection model to perform portrait detection on the preview image to obtain a human body bounding box.
- the electronic device can cut out the human body image from the preview image based on the human body bounding box.
- the electronic device can use the pre-trained key point detection model to perform key point detection on the human body image to obtain the human body key point set of the human body in the preview image.
- the electronic device may end the process.
- determining a set of composition key points corresponding to the shooting scene includes:
- the electronic device may use a pre-trained scene recognition model to perform scene recognition on the preview image to obtain a scene recognition result.
- the electronic device can divide the preview image into a foreground image and a background image according to the scene recognition result.
- the scene recognition result may include the foreground label of the image and the background label of the image, and the electronic device may divide the preview image into the foreground image and the background image according to the foreground label and the background label.
- the foreground label is used to describe an object that is in a prominent position in the preview image and can be identified by a rectangular frame.
- the background label is used to describe the overall information of the preview image.
- the background label can be "mountain view”, “water scene”, “snow scene”, “rain scene”, etc.
- the foreground label can be "person”, “cat”, “dog” "Wait.
- the foreground label can be "person” and the background label can be "waterscape”
- the foreground image can be an image containing "people”
- the background image can be "waterscape” image.
- a plurality of different preset background images can be preset in the electronic device, and a plurality of different candidate key point sets can be set for each preset background image.
- the preset background image may be a “water scene” image, a “mountain view” image, a “snow scene” image, and so on.
- Each set of candidate key points can include: nose, left eye, right eye, left ear, right ear, neck, left shoulder, right shoulder, left elbow, right elbow, left wrist, right wrist, left hip, right hip, left knee , Right knee, left ankle, right ankle, and other candidate key points.
- the electronic device can acquire a plurality of preset background images. Subsequently, the electronic device can determine whether there is a preset background image matching the background image among the plurality of preset background images. Wherein, assuming that the background image is a “water scene” image, and there is also a “water scene” image in the preset background image, the electronic device may determine that there is a preset background image matching the background image among the plurality of preset background images.
- the electronic device can obtain a plurality of candidate key point sets corresponding to the preset background image matching the background image, and use it as the background A set of multiple candidate key points corresponding to the image. After that, the electronic device can determine the human body type of the human body in the shooting scene. Then, the electronic device may determine the candidate key point set corresponding to the human body type among the multiple candidate key point sets as the composition key point set corresponding to the shooting scene.
- the electronic device may also set a corresponding type for each candidate key point set corresponding to each preset background image. For example, if a certain candidate key point set includes the nose, left eye, right eye, left ear, right ear, neck, left shoulder, right shoulder and other key points above the human chest, the electronic device can determine the corresponding candidate key point set
- the type is a bust type.
- the electronic device may determine that the type corresponding to the set of candidate key points is a full-body image type. After determining the type of the human body, the electronic device can obtain the type corresponding to each candidate key point set corresponding to the background image to obtain multiple types.
- the electronic device may determine the type matching the human body type from the multiple types, and determine the candidate key point set corresponding to the type matching the human body type as the candidate key point set corresponding to the human body type. For example, suppose that the human body type is a full-length image type, and the multiple types include a bust type and a full-length image type. Then, the electronic device may determine the candidate key point set corresponding to the full-length image type among the multiple types as the candidate key point set corresponding to the human body type.
- the photographing method provided in the embodiment of the present application may further include:
- the human body type is a full body image type
- the types corresponding to the candidate key point set K1 and the candidate key point set K2 are both full body image types. Only the candidate key points included in the candidate key point set K1 and the candidate key point set K2 are in The position in the screen coordinate system is different, then the candidate key point set corresponding to the human body type includes the candidate key point set K1 and the candidate key point set K2.
- the electronic device when the electronic device sets multiple different candidate key point sets for each preset background image, the electronic device may also set multiple different composition bounding boxes for each preset background image. Among them, each candidate key point set corresponds to a composition bounding box. When there are multiple candidate key point sets corresponding to the human body type, for each candidate key point set corresponding to the human body type, the electronic device may obtain its corresponding composition bounding box. Subsequently, the electronic device may determine a set of candidate key points in which the composition bounding box matches the bounding box of the human body among the plurality of candidate key point sets corresponding to the human body type as the composition key point set corresponding to the shooting scene.
- the electronic device may determine that the composition bounding box corresponding to the candidate key point set matches the human body bounding box.
- the preset first difference range and the preset second difference range may be stored in the electronic device in advance.
- the electronic device may also Obtain the coordinates of the upper left corner of the composition bounding box corresponding to each first candidate key point set, and obtain the coordinates of the upper left corner of the human body bounding box, and compare the coordinates of the upper left corner of the composition bounding box in the plurality of first candidate key point sets to the body boundary
- the first candidate key point set with the same coordinates of the upper left corner of the frame is determined as the composition key point set corresponding to the shooting scene.
- the electronic device can also obtain the coordinates of the lower right corner of the composition bounding box corresponding to each second candidate key point set, and obtain the coordinates of the lower right corner of the human body bounding box, and combine the plurality of second candidate key point sets in the composition boundary
- the second candidate key point set whose coordinates of the lower right corner of the frame are the same as the coordinates of the lower right corner of the human body boundary box is determined as the composition key point set corresponding to the shooting scene.
- the electronic device may be preset with a composition database.
- the composition database can be defined as a hash table.
- the hash table is a data structure that directly accesses the storage location in memory based on the key (Key), which is called the value (Value). In other words, it accesses records by calculating a function about the key value and mapping the data to be queried to a position in the table.
- the key refers to each preset background image, such as "water scene” image, "mountain view” image, "snow scene” image, etc.
- the value refers to the candidate key point set and composition bounding box corresponding to each preset background image.
- a preset background image can correspond to multiple candidate key point sets and multiple composition bounding boxes, where each candidate key point set corresponding to each preset background image corresponds to a composition bounding box corresponding to each preset background image correspond.
- the electronic device can obtain a preset background image that matches the background image. If the background image is a "water scene” image, it matches the background image The preset background image of is also a "water scene” image.
- the electronic device can use a preset background image matching the background image as a key.
- the electronic device can find multiple candidate key point sets and multiple composition bounding boxes mapped in the composition database through this key, and use multiple candidate key point sets and multiple composition bounding boxes as the multiple corresponding to the background image. A set of candidate keypoints and multiple composition bounding boxes.
- the set of key points of the human body does not match the set of key points of the composition, including: the average distance is greater than or equal to the preset average distance.
- the set of human body key points includes: nose N1, left eye LE1, and right eye RE1;
- the composition key point set includes: nose N2, left eye LE2, and right eye RE2.
- the electronic device can calculate the distance L1 between the nose N1 and the nose N2, the distance L2 between the left eye LE1 and the left eye LE2, and the distance L3 between the right eye RE1 and the right eye RE2; subsequently, the electronic device can calculate the distance L1, The average distance between L2 and L3.
- the electronic device can determine that the set of key points of the human body does not match the set of key points of the composition.
- the electronic device can determine that the set of key points of the human body matches the set of key points of the composition.
- the preset average distance can be stored in the electronic device in advance according to actual conditions, and there is no specific limitation here.
- "generating and outputting prompt information for adjusting the posture of the electronic device” includes:
- the electronic device may randomly generate multiple candidate vectors.
- the candidate vector can include size and direction.
- the size of the candidate vector can be 1 cm, and the direction is horizontal to right.
- the electronic device can predict the set of key points of the target human body obtained after adjusting the posture of the electronic device according to each candidate vector. For example, assuming that the size of a candidate vector is 1 cm and the direction is horizontal to the right, the electronic device can predict that when the user moves the electronic device 1 cm horizontally to the right, the electronic device will detect the key points of the human body in the current shooting scene , The set of key points of the target human body obtained.
- the electronic device can detect whether it matches the composition key point set. When the target human body key point set corresponding to a certain candidate vector matches the composition key point set, the electronic device may determine the candidate vector as the target vector. Subsequently, the electronic device can generate and output prompt information for adjusting the posture of the electronic device according to the target vector. For example, if the size of the target vector is 1 cm and the direction is horizontal to the right, then the electronic device can be displayed on the display screen: Please move the electronic device horizontally to the right by 1 cm. The electronic device can also display a progress bar on the display screen. The length of the progress bar corresponds to 1 cm.
- the progress bar can gradually become shorter as the electronic device continues to move to the right; the progress bar can continue to follow the electronic device. Move to the left and slowly grow longer. When the electronic device moves 1 cm, the progress bar also disappears. Therefore, the user can confirm whether the electronic device has moved 1 cm according to whether the progress bar disappears.
- the human body key point set does not match the composition key point set may include: the face key point set does not match the target composition key point set.
- the electronic device can judge whether the part of the human body key point set matches a part of the composition key point set in the composition key point set. Whether the set of key points of the human body matches the set of key points of the composition.
- the electronic device can determine the face key point set from the human body key point set, such as the nose N1, the left eye LE1, and the right eye RE1. Subsequently, the electronic device can obtain the abscissa of each key point of the face in the screen coordinate system to obtain multiple first abscissas. Then, the electronic device can calculate the first average value of the plurality of first abscissas. When the first average value is within the preset average value range, the electronic device can determine the target composition key point set corresponding to the face key point set from the composition key point set, such as the nose N2, the left eye LE2, and the right eye RE2.
- the electronic device can detect whether the set of key points of the face matches the set of key points of the target composition. If it does not match, the electronic device can determine that the set of key points of the human body does not match the set of key points of the composition. If they match, the electronic device can determine that the set of key points of the human body matches the set of key points of the composition.
- the preset mean value range can be pre-stored in the electronic device according to actual conditions.
- composition key point set corresponding to the face key point set from the composition key point set
- it may further include:
- the set of key points on the face does not match the set of key points on the target composition
- the key point set of a human face includes a nose N1, a left eye LE1, and a right eye RE1
- the target composition key point set includes a nose N2, a left eye LE2, and a right eye RE2.
- the abscissa of nose N1 is 1, the ordinate is 2; the abscissa of left eye LE1 is 4, and the ordinate is 1, the abscissa of right eye RE1 is 4, and the ordinate is 3; the abscissa of nose N2 is 3, The ordinate is 3; the abscissa of the left eye LE2 is 6, and the ordinate is 2; the abscissa of the right eye RE2 is 6, and the ordinate is 4; the first preset distance is 2.
- the first average value is 3, the second average value is 2, the third average value is 5, and the fourth average value is 3.
- the first target coordinate is (3, 2), and the second target coordinate is (5, 3).
- the first distance between the first target coordinate and the second target coordinate is It can be determined that the first distance is greater than the first preset distance, and then the electronic device can determine that the face key point set does not match the target composition key point set, so that it can determine that the human body key point set does not match the composition key point set.
- the respective abscissas and ordinates of the nose N1, the left eye LE1, the right eye RE1, the nose N2, the left eye LE2, and the right eye RE2 are coordinates in the screen coordinate system.
- the first preset distance can be pre-stored in the electronic device according to actual conditions.
- "generating and outputting prompt information for adjusting the posture of the electronic device” includes:
- the first moving direction may be a direction from the first target coordinate to the second target coordinate.
- the first moving direction is horizontal to the right
- the first distance is Then the electronic device can be displayed on the display: Please move the electronic device horizontally to the right.
- the electronic device can also display a progress bar on the display screen, the progress bar corresponding to the first distance, and the progress bar can gradually become shorter as the electronic device moves to the right; the progress bar can follow the electronic device Keep moving to the left and slowly grow longer.
- the progress bar also disappears. Therefore, the user can confirm when to stop moving the electronic device according to whether the progress bar disappears.
- the set of key points of the human body does not match the set of key points of the composition may include: the second distance is greater than or equal to the second preset distance.
- the electronic device can also detect whether there is a preset key point in the set of human body key points. If there are no preset key points in the human body key point set, the electronic device can obtain the center coordinates of the human body boundary box, that is, the first center coordinates, and the center coordinates of the composition boundary box corresponding to the composition key point set, that is, the second center coordinates. Subsequently, the electronic device may calculate the second distance between the first center coordinate and the second center coordinate. When the second distance is greater than or equal to the second preset distance, the electronic device may determine that the set of key points of the human body does not match the set of key points of the composition.
- the electronic device may determine that the set of key points of the human body matches the set of key points of the composition.
- the first center coordinates and the second center coordinates are both coordinates in the screen coordinate system.
- the second preset distance may be pre-stored in the electronic device according to actual conditions.
- the preset key points may include left knee, right knee, left ankle, right ankle, and so on.
- the electronic device can determine that the set of key points of the human body does not match the set of key points of the composition.
- "generating and outputting prompt information for adjusting the posture of the electronic device” includes:
- the second moving direction may be a direction from the first center coordinate to the second center coordinate. Assuming that the second moving direction is horizontal to the right, the second distance is Then the electronic device can be displayed on the display: Please move the electronic device horizontally to the right. At the same time, the electronic device can also display a progress bar on the display screen, the progress bar corresponding to the second distance, and the progress bar can gradually become shorter as the electronic device moves to the right; the progress bar can follow the electronic device Keep moving to the left and slowly grow longer. When the electronic device moves the second distance, the progress bar also disappears. Therefore, the user can confirm when to stop moving the electronic device according to whether the progress bar disappears.
- the human body key point set does not match the composition key point set may include: the third distance is greater than or equal to the third preset distance.
- the face key point set includes nose N1, left eye LE1, and right eye RE1
- the target composition key point set includes nose N2, left eye LE2, and right eye RE2.
- the ordinate of the nose N1 is 2; the ordinate of the left eye LE1 is 1; the ordinate of the right eye RE1 is 3; the ordinate of the nose N2 is 3; the ordinate of the left eye LE2 is 2; the ordinate of the right eye RE2 is Is 4; the first center abscissa of the human body boundary box is 2; the second center abscissa of the composition boundary box corresponding to the composition key point set is 4; the preset third distance is 2.
- the fifth mean is 2 and the sixth mean is 3.
- the third target coordinate is (2, 2), and the fourth target coordinate is (4, 3).
- the third distance between the third target coordinate and the fourth target coordinate is It can be determined that the third distance is greater than the third preset distance, and the electronic device can determine that the set of key points of the human body does not match the set of key points of the composition. It can be understood that if the third distance is less than the preset distance, the electronic device can determine that the set of key points of the human body matches the set of key points of the composition.
- the first center abscissa of the human body boundary box is the abscissa of the center of the human body boundary box in the screen coordinate system
- the second center abscissa of the composition boundary box corresponding to the composition key point set is the composition boundary corresponding to the composition key point set
- the preset third distance can be stored in the electronic device according to actual conditions.
- the preset key points may include left knee, right knee, left ankle, right ankle, and so on.
- "generating and outputting prompt information for adjusting the posture of the electronic device” includes:
- the third moving direction may be a direction from the third target coordinate to the fourth target coordinate. Assuming that the third moving direction is horizontal to the right, and the third distance is Then the electronic device can be displayed on the display: Please move the electronic device horizontally to the right. At the same time, the electronic device can also display a progress bar on the display screen, the progress bar corresponding to the third distance, and the progress bar can gradually become shorter as the electronic device moves to the right; the progress bar can follow the electronic device Keep moving to the left and slowly grow longer. When the electronic device moves the third distance, the progress bar also disappears. Therefore, the user can confirm whether to stop moving the electronic device according to whether the progress bar disappears.
- the preset state may be a horizontal state.
- the electronic device can also obtain the pitch angle and roll of the electronic device through the azimuth sensor such as the gyroscope sensor. Horn. Then, it is judged whether the electronic device is in a horizontal state according to the pitch angle and the roll angle. If the pitch angle and the roll flip angle are both 180 degrees, the electronic device can determine that the electronic device is in a horizontal state, then the electronic device can perform key point detection on the human body in the shooting scene to obtain a set of human body key points of the human body.
- the electronic device can determine that the electronic device is not in a horizontal state.
- the electronic device can generate and output prompt information for adjusting the state of the electronic device.
- the prompt message may be: Please keep the electronic device in a horizontal state.
- the electronic device can also continuously detect whether the acquired pitch angle and roll angle are 180 degrees.
- the electronic device may generate a prompt message for prompting the user to stop adjusting the state of the electronic device.
- the electronic device can detect the key points of the human body in the shooting scene to obtain a set of human body key points of the human body.
- the preset state may be a vertical state.
- the electronic device can also obtain the pitch angle and roll of the electronic device through the azimuth sensor such as the gyroscope sensor. Horn. Then, it is judged whether the electronic device is in a vertical state according to the pitch angle and the roll angle. If the pitch angle and the roll flip angle are both 90 degrees, the electronic device can determine that the electronic device is in a vertical state, and then the electronic device can perform key point detection on the human body in the shooting scene to obtain a set of human body key points of the human body.
- the electronic device can determine that the electronic device is not in a vertical state.
- the electronic device can generate and output prompt information for adjusting the state of the electronic device.
- the prompt message may be: Please make the electronic device in a vertical state.
- the electronic device can also continuously detect whether the acquired pitch angle and roll angle are 90 degrees.
- the electronic device may generate a prompt message for prompting the user to stop adjusting the posture of the electronic device.
- the electronic device can perform key point detection on the human body in the shooting scene to obtain a set of human body key points of the human body.
- adjusting the state of the electronic device can be such that the electronic device is in a horizontal state or a vertical state with respect to the ground. Adjusting the posture of the electronic device can be based on the electronic device being in any state (including the horizontal state or the vertical state), and the electronic device relative to the user horizontally forward, horizontally backward, horizontally to the left, horizontally to the right, vertically upward, Move vertically down, etc.
- FIG. 2 is a schematic diagram of a second process of a photographing method provided by an embodiment of the present application.
- the photographing method may be applied to an electronic device, and the process may include:
- the electronic device acquires a preview image of a shooting scene.
- the electronic device can obtain a preview image G1 of the shooting scene.
- the scene to which the camera of the electronic device is aimed is the shooting scene.
- the electronic device uses the portrait detection model to perform portrait detection on the preview image to obtain a human body bounding box.
- the electronic device can use the pre-trained portrait detection model to perform portrait detection on the preview image G1 to obtain the human body bounding box B1.
- the electronic device uses the portrait detection model to perform portrait detection on the preview image, and there are multiple human body bounding boxes obtained, or the human body bounding box is not obtained, the electronic device can directly end the process.
- the electronic device cuts out a human body image from the preview image based on the human body bounding box.
- the electronic device can cut the preview image along the human body boundary box to cut out the human body image G2 from the preview image.
- the electronic device uses the key point detection model to perform key point detection on the human body image to obtain a set of human body key points of the human body.
- the electronic device can use the pre-trained key point detection model to perform key point detection on the human body image G2 to obtain a set of human body key points of the human body.
- the set of key points of the human body can include: nose, left eye, right eye, left ear, right ear, neck, left shoulder, right shoulder, left elbow, right elbow, left wrist, right wrist, left hip, right hip, left knee , Right knee, left ankle, right ankle and other key points of the human body.
- the electronic device divides the preview image into a foreground image and a background image.
- the electronic device may also acquire multiple image samples, and acquire the foreground label and background label of each image sample. Subsequently, the electronic device can use multiple image samples, and the foreground label and background label of each image sample to train deep learning models such as convolutional neural networks to obtain a trained model, which can be used as a scene recognition model .
- deep learning models such as convolutional neural networks
- the foreground label is used to describe an object that is in a prominent position in the image sample and can be identified by a rectangular frame.
- the background label is used to describe the overall information of the image sample.
- the background label can be "mountain view”, “water scene”, “snow scene”, “rain scene”, etc.
- the foreground label can be "person”, “cat”, “dog” "Wait.
- the foreground label can be "person” and the background label can be "water scene”.
- the electronic device can use the pre-trained scene recognition model to perform scene recognition on the preview image G1 to obtain the foreground label and background label of the preview image G1, and then according to the foreground label of the preview image G1 And the background label divides the preview image G1 into a foreground image and a background image.
- the electronic device recognizes that the background label of the preview image is "mountain view”, then the background image is a "mountain view” image; the electronic device recognizes that the foreground label of the preview image is "person", Then, the foreground image is an image containing "people".
- the electronic device determines multiple candidate key point sets corresponding to the background image.
- a plurality of different preset background images can be preset in the electronic device, and a plurality of different candidate key point sets with reasonable composition are set for each preset background image.
- the preset background image may be a “water scene” image, a “mountain view” image, a “snow scene” image, and so on.
- Each set of candidate key points can include: nose, left eye, right eye, left ear, right ear, neck, left shoulder, right shoulder, left elbow, right elbow, left wrist, right wrist, left hip, right hip, left knee , Right knee, left ankle, right ankle, and other candidate key points.
- the electronic device may acquire multiple preset background images. Subsequently, the electronic device can determine whether there is a preset background image matching the background image among the plurality of preset background images. Wherein, assuming that the background image is a "mountain view" image, and there is also a "mountain view” image in the preset background image, the electronic device may determine that there is a preset background image matching the background image among the plurality of preset background images.
- the electronic device can obtain a plurality of candidate key point sets corresponding to the preset background image matching the background image, and use it as the background A set of multiple candidate key points corresponding to the image.
- the electronic device determines the body type of the human body.
- the electronic device determines the candidate key point set corresponding to the human body type among the multiple candidate key point sets as the composition key point set corresponding to the shooting scene.
- the electronic device when multiple candidate key point sets corresponding to the background image are obtained, the electronic device can determine the human body type of the human body in the shooting scene. Then, the electronic device may determine the candidate key point set corresponding to the human body type among the multiple candidate key point sets as the composition key point set corresponding to the shooting scene.
- the electronic device may also set a corresponding type for each candidate key point set corresponding to each preset background image. For example, if a certain candidate key point set includes the nose, left eye, right eye, left ear, right ear, neck, left shoulder, right shoulder and other key points above the human chest, the electronic device can determine the corresponding candidate key point set
- the type is a bust type.
- the electronic device may determine that the type corresponding to the set of candidate key points is a full-body image type. After determining the type of the human body, the electronic device can obtain the type corresponding to each candidate key point set corresponding to the background image to obtain multiple types.
- the electronic device may determine the type matching the human body type from the multiple types, and determine the candidate key point set corresponding to the type matching the human body type as the candidate key point set corresponding to the human body type.
- the candidate key point set corresponding to the human body type can be used as the composition key point set corresponding to the shooting scene. For example, suppose that the human body type is a full-length image type, and the multiple types include a bust type and a full-length image type. Then, the electronic device may determine the candidate key point set corresponding to the full-length image type among the multiple types as the candidate key point set corresponding to the human body type.
- the candidate key point set corresponding to the human body type can be used as the composition key point set corresponding to the shooting scene.
- the electronic device calculates the distance between each key point of the human body and the corresponding key point of the composition to obtain multiple distances.
- the electronic device calculates an average distance of multiple distances.
- the electronic device can calculate the distance between each key point of the human body and the corresponding key point of the composition to obtain multiple distances.
- the set of human body key points includes: nose N1, left eye LE1, right eye RE1, left ear LA1, right ear RA1, neck K1;
- composition key point set includes: nose N2, left eye LE2, right eye RE2, left ear LA2, right ear RA2, neck K2.
- the electronic device can calculate the distance L1 between the nose N1 and the nose N2.
- the distance L1 between the nose N1 and the nose N2 is the electronic device can calculate the distance L2 between the left eye LE1 and the left eye LE2 in the above manner; the distance L3 between the right eye RE1 and the right eye RE2; the distance L4 between the left ear LA1 and the left ear LA2, The distance between the right ear RA1 and the right ear RA2 is L5; the distance between the neck K1 and the neck K2 is L6.
- the electronic device can calculate the average distances of L1, L2, L3, L4, L5, and L6. For example, suppose L1 is L2 is L3 is 4; L4 is 3; L5 is 2; L6 is 4, so the average distance is 3.
- the electronic device When the average distance is greater than or equal to the preset average distance, the electronic device generates and outputs prompt information for adjusting the posture of the electronic device.
- the electronic device can determine whether the average distance is greater than or equal to the preset average distance. If the average distance is greater than or equal to the preset average distance, the electronic device can generate and output prompt information for adjusting the posture of the electronic device, so that the user can adjust the posture of the electronic device according to the prompt information, so that after the posture of the electronic device is adjusted, the electronic device
- the real-time average distance obtained by the device is less than the preset average distance.
- the preset average distance can be stored in the electronic device in advance.
- the shooting scene also changes continuously.
- the key points of the human body in the shooting scene are detected, and the positions of the human body key points in the obtained human body key point set will also change.
- the distance between each key point of the human body and the corresponding key point of the composition will also continue to change.
- the average distance calculated by the electronic device will also continue to change. This constantly changing average distance is the real-time average distance.
- the electronic device may generate multiple candidate vectors.
- the candidate vector can include size and direction.
- the size of the candidate vector can be 1 cm, and the direction is horizontal to right.
- the electronic device can predict the set of key points of the target human body obtained after adjusting the posture of the electronic device according to each candidate vector. For example, assuming that the size of a candidate vector is 1 cm and the direction is horizontal to the right, the electronic device can predict that when the user moves the electronic device 1 cm horizontally to the right, the electronic device will detect the key points of the human body in the current shooting scene , The set of key points of the target human body obtained. For each key point of the target human body corresponding to each candidate vector, the electronic device can calculate the distance between it and the corresponding key point of the composition to obtain multiple distances corresponding to each candidate vector. Subsequently, the electronic device can calculate the average distance of the multiple distances corresponding to each candidate vector; finally, the electronic device can determine the candidate vector whose average distance is less than the preset average distance among the multiple candidate vectors as the target vector.
- the electronic device can generate and output prompt information for adjusting the posture of the electronic device according to the target vector.
- the electronic device can be displayed on the display screen: Please move the electronic device horizontally to the right.
- the electronic device can also display a progress bar on the display screen.
- the length of the progress bar corresponds to 1 cm.
- the progress bar can gradually become shorter as the electronic device continues to move to the right; the progress bar can continue to follow the electronic device. Move to the left and slowly grow longer.
- the progress bar also disappears. Therefore, the user can confirm when to stop moving the electronic device according to whether the progress bar disappears.
- the electronic device shoots the shooting scene to obtain the target image.
- the electronic device when the real-time average distance is less than the preset average distance, the electronic device can shoot the shooting scene to obtain an image that meets certain aesthetic rules and has a reasonable composition, that is, the target image G3. Or, when the real-time average distance is less than the preset average distance, the electronic device may generate a prompt message to prompt the user to take a shot of the shooting scene. Then, the user can click the “shooting” button in the shooting application program interface to shoot the shooting scene and obtain the target image G3 that meets certain aesthetic rules.
- the electronic device can directly shoot the shooting scene to obtain an image that meets certain aesthetic rules, that is, the composition is reasonable.
- FIG. 8 is a schematic structural diagram of a photographing device provided by an embodiment of the application.
- the photographing device can be applied to electronic equipment.
- the photographing device 300 includes a detection module 301, a determination module 302, a generation module 303, and a photographing module 304.
- the detection module 301 is configured to detect the key points of the human body in the shooting scene to obtain a set of human body key points of the human body.
- the determining module 302 is configured to determine a set of composition key points corresponding to the shooting scene.
- the generating module 303 is configured to generate and output prompt information for adjusting the posture of the electronic device when the set of key points of the human body does not match the set of key points of the composition.
- the photographing module 304 is configured to photograph the photographing scene to obtain a target image when the real-time human body key point set of the human body matches the composition key point set.
- the detection module 301 may be used to: obtain a preview image of the shooting scene; use a portrait detection model to perform portrait detection on the preview image to obtain a human body bounding box; and obtain a human body bounding box based on the human body bounding box. Cut out the human body image in the middle; use the key point detection model to perform key point detection on the human body image to obtain the human body key point set of the human body.
- the determining module 302 may be used to: divide the preview image into a foreground image and a background image; determine multiple candidate key point sets corresponding to the background image; determine the body type of the human body; The candidate key point set corresponding to the human body type among the plurality of candidate key point sets is determined as the composition key point set corresponding to the shooting scene.
- the determining module 302 may be used to: when there are multiple candidate key point sets corresponding to the human body type, for each candidate key point set corresponding to the human body type, obtain its corresponding Composition bounding box; determining a set of candidate key points matching the composition bounding box with the body bounding box among the plurality of candidate key point sets corresponding to the human body type as the composition key point set corresponding to the shooting scene.
- the determining module 302 may be used to: calculate the distance between each key point of the human body and the corresponding key point of the composition to obtain multiple distances; calculate the average distance of the multiple distances;
- the generating module 303 may be used to generate and output prompt information for adjusting the posture of the electronic device when the average distance is greater than or equal to the preset average distance.
- the generation module 303 can be used to: generate multiple candidate vectors; predict the set of key points of the target human body obtained after adjusting the posture of the electronic device according to each candidate vector; and combine the key points of the target human body among the multiple candidate vectors.
- a candidate vector whose point set matches the composition key point set is determined as a target vector; and prompt information for adjusting the posture of the electronic device is generated and output according to the target vector.
- the determining module 302 may be used to: determine a face key point set from the human body key point set; obtain the abscissa of each face key point to obtain multiple first abscissas; A first mean value of a plurality of first abscissas; when the first mean value is within a preset mean value range, determine a target composition key point set corresponding to the face key point set from the composition key point set;
- the generating module 303 may be used to generate and output prompt information for adjusting the posture of the electronic device when the set of key points of the human face does not match the set of key points of the target composition.
- the determining module 302 may be used to: obtain the ordinate of each key point of the face, obtain multiple first ordinates, and obtain the abscissa and ordinate of each target composition key point, to obtain multiple A second abscissa and a plurality of second ordinates; calculating a second average value of the plurality of first ordinates, a third average value of the plurality of second abscissas, and a first average value of the plurality of second ordinates Four average values; determine a first target coordinate according to the first average value and the second average value, and determine a second target coordinate according to the third average value and the fourth average value; calculate the first target coordinate and The first distance between the second target coordinates;
- the generating module 303 may be used to generate and output prompt information for adjusting the posture of the electronic device when the first distance is greater than or equal to the first preset distance.
- the determining module 302 may be used to: when the first mean value is not within the preset mean value range, detect whether there is a preset key point in the human body key point set; if the human body key point is If there is no preset key point in the set, the first center coordinates of the human body bounding box and the second center coordinates of the composition bounding box corresponding to the set of composition key points are acquired; the first center coordinates and the The second distance between the second center coordinates;
- the generating module 303 may be used to generate and output prompt information for adjusting the posture of the electronic device when the second distance is greater than or equal to the second preset distance.
- the determining module 302 may be configured to: if there are preset key points in the human body key point set, obtain the first center abscissa of the human body boundary box, and the composition key point set corresponds to The second center abscissa of the composition bounding box of the composition; determine the target composition key point set corresponding to the face key point set from the composition key point set; obtain the ordinate of each face key point to obtain multiple first Three ordinates, and obtain the ordinates of the key points of each target composition to obtain multiple fourth ordinates; calculate the fifth mean value of the multiple third ordinates, and the sixth ordinate of the multiple fourth ordinates Mean; according to the first central abscissa and the fifth average value, determine the third target coordinates, and according to the second central abscissa and the sixth average, determine the fourth target coordinates; calculate the third target coordinates A third distance from the fourth target coordinate;
- the generating module 303 may be used to generate and output prompt information for adjusting the posture of the electronic device when the third distance is greater than or equal to the third preset distance.
- the embodiment of the present application provides a computer-readable storage medium on which a computer program is stored.
- the computer program is executed on a computer, the computer is caused to execute the process in the photographing method provided in this embodiment.
- An embodiment of the present application also provides an electronic device, including a memory and a processor, and the processor is configured to execute a process in the photographing method provided in this embodiment by calling a computer program stored in the memory.
- the above-mentioned electronic device may be a mobile terminal such as a tablet computer or a smart phone.
- FIG. 9 is a schematic diagram of the first structure of an electronic device provided by an embodiment of this application.
- the electronic device 400 may include components such as a camera module 401, a memory 402, and a processor 403. Those skilled in the art can understand that the structure of the electronic device shown in FIG. 9 does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or a combination of certain components, or different component arrangements.
- the camera module 401 may include a lens, an image sensor, and an image signal processor.
- the lens is used to collect an external light source signal and provide it to the image sensor.
- the image sensor senses the light source signal from the lens and converts it into a digitized original image, namely RAW image, and provide the RAW image to the image signal processor for processing.
- the image signal processor can perform format conversion and noise reduction on the RAW image to obtain a YUV image.
- RAW is an unprocessed and uncompressed format, which can be vividly called a "digital negative.”
- YUV is a color coding method, where Y represents brightness, U represents chroma, and V represents density. Human eyes can intuitively feel the natural features contained in YUV images.
- the memory 402 can be used to store application programs and data.
- the application program stored in the memory 402 contains executable code.
- Application programs can be composed of various functional modules.
- the processor 403 executes various functional applications and data processing by running application programs stored in the memory 402.
- the processor 403 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device, and executes the electronic device by running or executing the application program stored in the memory 402 and calling the data stored in the memory 402.
- the various functions and processing data of the electronic equipment can be used to monitor the electronic equipment as a whole.
- the processor 403 in the electronic device will load the executable code corresponding to the process of one or more application programs into the memory 402 according to the following instructions, and the processor 403 will run and store the executable code in the memory.
- the application in 402 thus executes:
- the shooting scene is photographed to obtain the target image.
- the electronic device 400 may include a camera module 401, a memory 402, a processor 403, a touch screen 404, a speaker 405, a microphone 406 and other components.
- the camera module 401 may include an image processing circuit, which may be implemented by hardware and/or software components, and may include various processing units that define an image signal processing (Image Signal Processing) pipeline.
- the image processing circuit may at least include a camera, an image signal processor (Image Signal Processor, ISP processor), a control logic, an image memory, a display, and so on.
- the camera may at least include one or more lenses and image sensors.
- the image sensor may include a color filter array (such as a Bayer filter). The image sensor can obtain the light intensity and wavelength information captured by each imaging pixel of the image sensor, and provide a set of raw image data that can be processed by the image signal processor.
- the image signal processor can process the original image data pixel by pixel in a variety of formats. For example, each image pixel may have a bit depth of 8, 10, 12, or 14 bits, and the image signal processor may perform one or more image processing operations on the original image data and collect statistical information about the image data. Among them, the image processing operations can be performed with the same or different bit depth accuracy.
- the original image data can be stored in the image memory after being processed by the image signal processor.
- the image signal processor can also receive image data from the image memory.
- the image memory may be a part of a memory device, a storage device, or an independent dedicated memory in an electronic device, and may include DMA (Direct Memory Access) features.
- DMA Direct Memory Access
- the image signal processor can perform one or more image processing operations, such as temporal filtering.
- the processed image data can be sent to the image memory for additional processing before being displayed.
- the image signal processor may also receive processed data from the image memory, and perform image data processing in the original domain and in the RGB and YCbCr color spaces on the processed data.
- the processed image data can be output to a display for viewing by the user and/or further processed by a graphics engine or GPU (Graphics Processing Unit, graphics processor).
- the output of the image signal processor can also be sent to the image memory, and the display can read image data from the image memory.
- the image memory may be configured to implement one or more frame buffers.
- the statistical data determined by the image signal processor can be sent to the control logic.
- the statistical data may include the statistical information of the image sensor such as automatic exposure, automatic white balance, automatic focus, flicker detection, black level compensation, and lens shading correction.
- the control logic may include a processor and/or microcontroller that executes one or more routines (such as firmware).
- routines can determine the control parameters of the camera and ISP control parameters based on the received statistical data.
- the control parameters of the camera may include camera flash control parameters, lens control parameters (for example, focal length for focusing or zooming), or a combination of these parameters.
- ISP control parameters may include gain levels and color correction matrices for automatic white balance and color adjustment (for example, during RGB processing).
- FIG. 11 is a schematic diagram of the structure of the image processing circuit in this embodiment. As shown in FIG. 11, for ease of description, only various aspects of the image processing technology related to the embodiments of the present application are shown.
- the image processing circuit may include: a camera, an image signal processor, a control logic, an image memory, and a display.
- the camera may include one or more lenses and image sensors.
- the camera may be any one of a telephoto camera or a wide-angle camera.
- the first image collected by the camera is transmitted to the image signal processor for processing.
- the image signal processor may send statistical data of the first image (such as the brightness of the image, the contrast value of the image, the color of the image, etc.) to the control logic.
- the control logic can determine the control parameters of the camera according to the statistical data, so that the camera can perform operations such as autofocus and automatic exposure according to the control parameters.
- the first image can be stored in the image memory after being processed by the image signal processor.
- the image signal processor can also read the image stored in the image memory for processing.
- the first image can be directly sent to the display for display after being processed by the image signal processor.
- the display can also read the image in the image memory for display.
- the electronic device may also include a CPU and a power supply module.
- the CPU is connected to the logic controller, image signal processor, image memory, and display, and the CPU is used to implement global control.
- the power supply module is used to supply power to each module.
- the application program stored in the memory 402 contains executable code.
- Application programs can be composed of various functional modules.
- the processor 403 executes various functional applications and data processing by running application programs stored in the memory 402.
- the processor 403 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device, and executes the electronic device by running or executing the application program stored in the memory 402 and calling the data stored in the memory 402.
- the various functions and processing data of the electronic equipment can be used to monitor the electronic equipment as a whole.
- the touch display screen 404 may be used to receive a user's touch control operation on the electronic device.
- the speaker 405 can play sound signals.
- the sensor 406 may include a gyroscope sensor, an acceleration sensor, a direction sensor, a magnetic field sensor, etc., which may be used to obtain the current posture of the electronic device 400.
- the processor 403 in the electronic device will load the executable code corresponding to the process of one or more application programs into the memory 402 according to the following instructions, and the processor 403 will run and store the executable code in the memory.
- the application in 402 thus executes:
- the shooting scene is photographed to obtain the target image.
- the processor 403 performs key point detection on the human body in the shooting scene, and when obtaining the human body key point set of the human body, it may execute: obtain a preview image of the shooting scene; Perform portrait detection on the preview image to obtain a human body boundary box; crop a human body image from the preview image based on the human body boundary box; use a key point detection model to perform key point detection on the human body image to obtain the human body of the human body Key points collection.
- the processor 403 when the processor 403 executes the determination of a set of composition key points corresponding to the shooting scene, it may execute: divide the preview image into a foreground image and a background image; determine multiple corresponding to the background image A set of candidate key points; determining a body type of the human body; determining a candidate key point set corresponding to the human body type among the plurality of candidate key point sets as a composition key point set corresponding to the shooting scene.
- the processor 403 may also execute: when there are multiple candidate key point sets corresponding to the human body type, for each candidate key point set corresponding to the human body type, obtain its corresponding Composition bounding box; determining a set of candidate key points matching the composition bounding box with the body bounding box among the plurality of candidate key point sets corresponding to the human body type as the composition key point set corresponding to the shooting scene.
- the processor 403 may also execute: calculate the distance between each human body key point and the corresponding composition key point to obtain multiple distances. Calculate the average distance of the multiple distances; then the processor 403 executes when the set of human body key points does not match the set of composition key points, when generating and outputting prompt information for adjusting the posture of the electronic device, it may execute: When the average distance is greater than or equal to the preset average distance, a prompt message for adjusting the posture of the electronic device is generated and output.
- the processor 403 when the processor 403 generates and outputs the prompt information for adjusting the posture of the electronic device, it may perform: generate multiple candidate vectors; predict the target human body obtained after adjusting the posture of the electronic device according to each candidate vector A set of key points; determining a candidate vector matching the set of key points of the target human body and the set of composition key points among the multiple candidate vectors as the target vector; generating and outputting prompt information for adjusting the posture of the electronic device according to the target vector.
- the processor 403 may also execute: determine the face key point set from the human body key point set; obtain each face key point To obtain multiple first abscissas; calculate the first average of the multiple first abscissas; when the first average is within the preset average range, determine from the set of composition key points and The target composition key point set corresponding to the face key point set; then the processor 403 executes when the human body key point set does not match the composition key point set, generating and outputting prompt information for adjusting the posture of the electronic device , It can be executed: when the set of key points of the face does not match the set of key points of the target composition, generating and outputting prompt information for adjusting the posture of the electronic device.
- the processor 403 may also execute: obtain the ordinate of each face key point , Obtain a plurality of first ordinates, and obtain the abscissa and ordinate of each target composition key point, obtain a plurality of second abscissas and a plurality of second ordinates; calculate the first ordinate of the plurality of first ordinates Two average values, the third average value of the plurality of second abscissas, and the fourth average value of the plurality of second ordinates; determine the first target coordinate according to the first average value and the second average value, and According to the third average value and the fourth average value, determine the second target coordinate; calculate the first distance between the first target coordinate and the second target coordinate; then the processor 403 executes when the human body is critical When the point set does not match the composition key point set, when generating and outputting prompt information for adjusting the posture of the electronic device, it may also execute: obtain the ordinate of each face key point , Obtain a plurality of first ordinates, and obtain the abs
- the processor 403 may also execute: when the first average value is not within a preset average value range, detecting the human body key Whether there is a preset key point in the point set; if there is no preset key point in the human body key point set, the first center coordinates of the human body bounding box and the composition bounding box corresponding to the composition key point set are obtained Calculate the second distance between the first center coordinates and the second center coordinates; then the processor 403 executes when the set of human body key points does not match the set of composition key points, When generating and outputting prompt information for adjusting the posture of the electronic device, it may be executed: when the second distance is greater than or equal to a second preset distance, generating and outputting prompt information for adjusting the posture of the electronic device.
- the processor 403 may also execute: if there is a preset key point in the body key point set, obtain the human body The first center abscissa of the bounding box, and the second center abscissa of the composition bounding box corresponding to the set of composition key points; determine the target composition key corresponding to the set of face key points from the set of composition key points Point collection; obtain the ordinate of each key point of the face, obtain multiple third ordinates, and obtain the ordinate of each target composition key point, obtain multiple fourth ordinates; calculate the multiple third ordinates The fifth average value of the fourth ordinate, and the sixth average value of the plurality of fourth ordinates; the third target coordinate is determined according to the first center abscissa and the fifth average value, and the third target coordinate is determined according to the second center abscissa and The sixth mean value determines the fourth target coordinates; calculates the third distance between the third target coordinates
- the photographing device provided in this embodiment of the application belongs to the same concept as the photographing method in the above embodiment. Any method provided in the photographing method embodiment can be run on the photographing device. For the specific implementation process, see The embodiment of the photographing method will not be repeated here.
- the computer program may be stored in a computer readable storage medium, such as stored in a memory, and executed by at least one processor, and may include the process of the embodiment of the photographing method during the execution.
- the storage medium may be a magnetic disk, an optical disc, a read only memory (ROM, Read Only Memory), a random access memory (RAM, Random Access Memory), etc.
- the photographing device of the embodiment of the present application its functional modules may be integrated into one processing chip, or each module may exist alone physically, or two or more modules may be integrated into one module.
- the above-mentioned integrated modules can be implemented in the form of hardware or software functional modules. If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer readable storage medium, such as a read-only memory, a magnetic disk or an optical disk, etc. .
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Evolutionary Computation (AREA)
- General Engineering & Computer Science (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Artificial Intelligence (AREA)
- General Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Biomedical Technology (AREA)
- Life Sciences & Earth Sciences (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Studio Devices (AREA)
- Image Analysis (AREA)
Abstract
本申请公开了一种拍照方法、装置、存储介质及电子设备。该方法包括:对拍摄场景中的人体进行关键点检测,得到人体关键点集合;确定与拍摄场景对应的构图关键点集合;当人体关键点集合与构图关键点集合不匹配时,生成并输出提示信息;当实时人体关键点集合与构图关键点集合匹配时,对拍摄场景进行拍摄,得到目标图像。
Description
本申请要求于2020年1月22日提交中国专利局、申请号为202010075364.1、申请名称为“拍照方法、装置、存储介质及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请属于电子技术领域,尤其涉及一种拍照方法、装置、存储介质及电子设备。
随着电子设备的不断发展,诸如智能手机等电子设备上的摄像头像素越来越高,使得越来越多的用户倾向使用智能手机等电子设备进行拍照。各大电子设备厂商为满足用户的拍照需求,对电子设备硬件不断更新升级,以提高电子设备的拍照像素。但拍摄出高质量的照片,不但需要电子设备的摄像头具备较高分辨率,而且用户自身也应具备一定的专业摄影技能,如合理的运用构图。
发明内容
本申请实施例提供一种拍照方法、装置、存储介质及电子设备,可以提高图像的质量。
第一方面,本申请实施例提供一种拍照方法,应用于电子设备,包括:
对拍摄场景中的人体进行关键点检测,得到所述人体的人体关键点集合;
确定与所述拍摄场景对应的构图关键点集合;
当所述人体关键点集合与所述构图关键点集合不匹配时,生成并输出调整电子设备的姿态的提示信息;
当所述人体的实时人体关键点集合与所述构图关键点集合匹配时,对拍摄场景进行拍摄,得到目标图像。
第二方面,本申请实施例提供一种拍照装置,应用于电子设备,包括:
检测模块,用于对拍摄场景中的人体进行关键点检测,得到所述人体的人体关键点集合;
确定模块,用于确定与所述拍摄场景对应的构图关键点集合;
生成模块,用于当所述人体关键点集合与所述构图关键点集合不匹配时,生成并输出调整电子设备的姿态的提示信息;
拍摄模块,用于当所述人体的实时人体关键点集合与所述构图关键点集合匹配时,对拍摄场景进行拍摄,得到目标图像。
第三方面,本申请实施例提供一种存储介质,其上存储有计算机程序,当所述计算机程序在计算机上执行时,使得所述计算机执行本申请实施例提供的拍照方法中的流程。
第四方面,本申请实施例还提供一种电子设备,包括存储器,处理器,所述处理器通过调用所述存储器中存储的计算机程序,用于执行本申请实施例提供的拍照方法中的流程。
下面结合附图,通过对本申请的具体实施方式详细描述,将使本申请的技术方案及其有益效果显而易见。
图1是本申请实施例提供的拍照方法的第一种流程示意图。
图2是本申请实施例提供的拍照方法的第二种流程示意图。
图3是本申请实施例提供的预览图像G1示意图。
图4是本申请实施例提供的人体边界框B1示意图。
图5是本申请实施例提供的人体图像G2示意图。
图6是本申请实施例提供的提示信息示意图。
图7是本申请实施例提供的目标图像G3示意图。
图8是本申请实施例提供的拍照装置的结构示意图。
图9是本申请实施例提供的电子设备的第一种结构示意图。
图10是本申请实施例提供的电子设备的第二种结构示意图。
图11是本申请实施例提供的图像处理电路的结构示意图。
请参照图示,其中相同的组件符号代表相同的组件,本申请的原理是以实施在一适当的运算环境中来举例说明。以下的说明是基于所例示的本申请具体实施例,其不应被视为限制本申请未在此详述的其它具体实施例。
本申请实施例提供一种拍照方法,应用于电子设备,包括:
对拍摄场景中的人体进行关键点检测,得到所述人体的人体关键点集合;
确定与所述拍摄场景对应的构图关键点集合;
当所述人体关键点集合与所述构图关键点集合不匹配时,生成并输出调整电子设备的姿态的提示信息;
当所述人体的实时人体关键点集合与所述构图关键点集合匹配时,对拍摄场景进行拍摄,得到目标图像。
在一种实施方式中,所述对拍摄场景中的人体进行关键点检测,得到所述人体的人体关键点集合,包括:
获取拍摄场景的预览图像;
利用人像检测模型对所述预览图像进行人像检测,得到人体边界框;
基于所述人体边界框从所述预览图像中裁切出人体图像;
利用关键点检测模型对所述人体图像进行关键点检测,得到所述人体的人体关键点集合。
在一种实施方式中,所述确定与所述拍摄场景对应的构图关键点集合,包括:
将所述预览图像划分为前景图像和背景图像;
确定所述背景图像对应的多个候选关键点集合;
确定所述人体的人体类型;
将所述多个候选关键点集合中与所述人体类型对应的候选关键点集合确定为与所述拍摄场景对应的构图关键点集合。
在一种实施方式中,所述方法还包括:
当与所述人体类型对应的候选关键点集合有多个时,对于每个与所述人体类型对应的候选关键点集合,获取其对应的构图边界框;
将多个与所述人体类型对应的候选关键点集合中构图边界框与所述人体边界框匹配的候选关键点集合确定为与所述拍摄场景对应的构图关键点集合。
在一种实施方式中,所述确定与所述拍摄场景对应的构图关键点集合之后,还包括:
计算每个人体关键点与对应的构图关键点之间的距离,得到多个距离;
计算所述多个距离的平均距离;
所述人体关键点集合与所述构图关键点集合不匹配,包括:所述平均距离大于或等于预设平均距离。
在一种实施方式中,所述生成并输出调整电子设备的姿态的提示信息,包括:
生成多个候选向量;
预测按照每个候选向量调整电子设备的姿态之后所得到的目标人体关键点集合;
将多个候选向量中目标人体关键点集合与所述构图关键点集合匹配的候选向量确定为目标向量;
根据所述目标向量生成并输出调整电子设备的姿态的提示信息。
在一种实施方式中,所述确定与所述拍摄场景对应的构图关键点集合之后,还包括:
从所述人体关键点集合中确定人脸关键点集合;
获取每个人脸关键点的横坐标,得到多个第一横坐标;
计算所述多个第一横坐标的第一均值;
当所述第一均值处于预设均值范围内时,从所述构图关键点集合中确定与所述人脸关键点集合对应的目标构图关键点集合;
所述人体关键点集合与所述构图关键点集合不匹配,包括:所述人脸关键点集合与所述目标构图关键点集合不匹配。
在一种实施方式中,所述从所述构图关键点集合中确定与所述人脸关键点集合对应的目标构图关键点集合之后,还包括:
获取每个人脸关键点的纵坐标,得到多个第一纵坐标,并获取每个目标构图关键点的横坐标和纵坐标,得到多个第二横坐标和多个第二纵坐标;
计算所述多个第一纵坐标的第二均值、所述多个第二横坐标的第三均值,以及所述多个第二纵坐标的第四均值;
根据所述第一均值和所述第二均值,确定第一目标坐标,并根据所述第三均值和所述第四均值,确定第二目标坐标;
计算所述第一目标坐标与所述第二目标坐标之间的第一距离;
所述人脸关键点集合与所述目标构图关键点集合不匹配,包括:所述第一距离大于或等于第一预设距离。
在一种实施方式中,所述计算所述多个第一横坐标的第一均值之后,还包括:
当所述第一均值不处于预设均值范围内时,检测所述人体关键点集合中是否存在预设关键点;
若所述人体关键点集合中不存在预设关键点,则获取所述人体边界框的第一中心坐标,以及所述构图关键点集合对应的构图边界框的第二中心坐标;
计算所述第一中心坐标与所述第二中心坐标之间的第二距离;
所述人体关键点集合与所述构图关键点集合不匹配,包括:所述第二距离大于或等于第二预设距离。
在一种实施方式中,所述检测所述人体关键点集合中是否存在预设关键点之后,还包括:
若所述人体关键点集合中存在预设关键点,则获取所述人体边界框的第一中心横坐标,以及所述构图关键点集合对应的构图边界框的第二中心横坐标;
从所述构图关键点集合中确定与所述人脸关键点集合对应的目标构图关键点集合;
获取每个人脸关键点的纵坐标,得到多个第三纵坐标,并获取每个目标构图关键点的纵坐标,得到多个第四纵坐标;
计算所述多个第三纵坐标的第五均值,以及所述多个第四纵坐标的第六均值;
根据所述第一中心横坐标和所述第五均值,确定第三目标坐标,并根据所述第二中心横坐标和第六均值,确定第四目标坐标;
计算所述第三目标坐标与所述第四目标坐标之间的第三距离;
所述人体关键点集合与所述构图关键点集合不匹配,包括:所述第三距离大于或等于第三预设距离。
可以理解的是,本申请实施例的执行主体可以是诸如智能手机或平板电脑等电子设备。
请参阅图1,图1是本申请实施例提供的拍照方法的第一种流程示意图,该拍照方法可应用于电子设备,该流程可以包括:
在101中,对拍摄场景中的人体进行关键点检测,得到该人体的人体关键点集合。
比如,电子设备可获取拍摄场景的预览图像。随后,电子设备可从该预览图像中确定出人体边界框。接着,电子设备可基于该人体边界框从预览图像中裁切出人体图像。最后,电子设备可对该人体图像进行关键点检测,得到拍摄场景中的人体的人体关键点集合。其中,人体关键点集合可包括:鼻子、左眼、右眼、左耳、右耳、脖子、左肩、右肩、左肘、右肘、左手腕、右手腕、左臀、右臀、左膝盖、右膝盖、左脚踝、右脚踝等人体关键点中的一种或多种。
其中,电子设备在根据用户操作启动拍摄类应用程序(比如电子设备的系统应用“相机”)后,其摄像头所对准的场景即为拍摄场景。比如,用户通过手指点击电子设备上“相机”应用的图标启动“相 机应用”后,若用户使用电子设备的摄像头对准某一场景,则该场景即为拍摄场景。根据以上描述,本领域技术人员应当理解的是,拍摄场景并非特指某一特定场景,而是跟随摄像头的指向所实时对准的场景。
在102中,确定与拍摄场景对应的构图关键点集合。
比如,电子设备中预置有多个不同的、构图合理的候选关键点集合。该候选关键点集合可与背景图像对应。其中,一个背景图像可对应多个候选关键点集合。每个候选关键点集合可包括:鼻子、左眼、右眼、左耳、右耳、脖子、左肩、右肩、左肘、右肘、左手腕、右手腕、左臀、右臀、左膝盖、右膝盖、左脚踝、右脚踝等候选关键点中的一种或多种。
在本申请实施例中,电子设备可将拍摄场景的预览图像划分为前景图像和背景图像。之后,电子设备可获取该背景图像对应的多个候选关键点集合,并将该多个候选关键点集合中的其中一个候选关键点集合确定为与该拍摄场景对应的构图关键点集合。
其中,前景图像可以为包含“人”的图像、包含动物“猫”的图像、包含动物“狗”的图像等。背景图像可以为“山景”图像、“水景”图像、“海景”图像、“雪景”图像等。
比如,与该拍摄场景对应的构图关键点集合可以为该背景图像对应的多个候选关键点集合中与该人体关键点集合相同或相似的候选关键点集合。例如,假设人体关键点集合包括鼻子、左眼、右眼、左耳、右耳、脖子、左肩、右肩这8个关键点。若拍摄场景的背景图像对应的多个候选关键点集合中存在一个候选关键点集合也仅包括鼻子、左眼、右眼、左耳、右耳、脖子、左肩、右肩这8个关键点,电子设备可以确定该候选关键点集合与人体关键点集合相同,则电子设备可将该候选关键点集合确定为与该拍摄场景对应的构图关键点集合。若该多个候选关键点集合中存在一个候选关键点集合也包括鼻子、左眼、右眼、左耳、右耳、脖子、左肩、右肩这8个关键点,同时还包括其他关键点,如还包括左肘和右肘这2个关键点,电子设备可确定该候选关键点集合与人体关键点集合相似,则电子设备也可以将该候选关键点集合确定为与该拍摄场景对应的构图关键点集合。
在103中,当人体关键点集合与构图关键点集合不匹配时,生成并输出调整电子设备的姿态的提示信息。
比如,当得到人体关键点集合和构图关键点集合之后,电子设备可判断该人体关键点集合与该构图关键点集合是否匹配。若该人体关键点集合与该构图关键点集合不匹配,电子设备可生成并输出调整电子设备的姿态的提示信息,从而使得人体的实时人体关键点集合与构图关键点集合匹配。
可以理解的是,随着电子设备的姿态的不断变化,拍摄场景也随之不断变化。随着拍摄场景的不断变化,对拍摄场景中的人体进行关键点检测,得到的人体关键点集合中的人体关键点的位置也会不断变化。该不断变化位置的人体关键点即为实时人体关键点,由实时人体关键点组成的集合即为实时人体关键点集合。
例如,在判断人体关键点集合与构图关键点集合是否匹配时,电子设备可计算每个人体关键点与对应的构图关键点之间的距离,得到多个距离;随后,电子设备可计算多个距离的平均距离;当该平均距离大于或等于预设平均距离时,电子设备判定人体关键点集合与构图关键点集合不匹配。其中,当人体关键点为鼻子时,与其对应的构图关键点也为鼻子;当人体关键点为左肩时,与其对应的构图关键点也为左肩。
又例如,在判断人体关键点集合与构图关键点集合是否匹配时,电子设备还可以从人体关键点集合中确定出人脸关键点集合,并从构图关键点集合中确定出与该人脸关键点集合对应的目标构图关键点集合。当该人脸关键点集合与该目标构图关键点集合不匹配时,电子设备可判定人体关键点集合与构图关键点集合不匹配。
又例如,在判断人体关键点集合与构图关键点集合是否匹配时,电子设备可确定人体关键点集合所包括的多个人体关键点的横坐标的均值A1和纵坐标的均值A2,并确定构图关键点集合所包括的多个构图关键点的横坐标的均值A3和纵坐标的均值A4。随后,电子设备可根据该均值A1和均值A2确定第一坐标。其中,该均值A1可作为第一坐标的横坐标,该均值A2可作为第一坐标的纵坐标。电子设备 可根据该均值A3和均值A4确定第二坐标。其中,该均值A3可作为第二坐标的横坐标,该均值A4可作为第二坐标的纵坐标。接着,电子设备可计算该第一坐标与第二坐标的距离。当第一坐标与第二坐标的距离大于或等于预设距离时,电子设备可判定人体关键点集合与构图关键点集合不匹配。多个人体关键点的横坐标和纵坐标、多个构图关键点的横坐标和纵坐标、第一坐标和第二坐标均为屏幕坐标系中的坐标。
在104中,当人体的实时人体关键点集合与构图关键点集合匹配时,对拍摄场景进行拍摄,得到目标图像。
在本申请实施例中,当人体的实时人体关键点集合与构图关键点集合匹配时,电子设备可对拍摄场景进行拍摄,从而得到符合一定美学规则,即构图合理的图像。或者,当人体的实时人体关键点集合与构图关键点集合匹配时,电子设备可生成一提示信息,以提示用户对拍摄场景进行拍摄。那么,用户可点击拍摄类应用程序界面中的“拍摄”按钮,以对拍摄场景进行拍摄,得到符合一定美学规则的目标图像。
可以理解的是,当人体关键点集合与构图关键点集合匹配时,电子设备可直接对拍摄场景进行拍摄,以得到符合一定美学规则,即构图合理的图像。
本申请实施例中,通过获取拍摄场景中的人体的人体关键点集合,并确定与拍摄场景对应的构图合理的构图关键点集合,在该人体关键点集合与构图关键点集合匹配时,可确认拍摄场景的预览图像构图合理。在该人体关键点集合与构图关键点集合不匹配时,可生成并输出调整电子设备的姿态的提示信息,以使拍摄场景的实时预览图像构图合理。从而可以使得对拍摄场景进行拍摄得到的图像构图合理,进而可以提高图像的质量。
在一实施例中,“对拍摄场景中的人体进行关键点检测,得到该人体的人体关键点集合”,包括:
(1)获取拍摄场景的预览图像;
(2)利用人像检测模型对预览图像进行人像检测,得到人体边界框;
(3)基于人体边界框裁切预览图像,得到人体图像;
(4)利用关键点检测模型对人体图像进行关键点检测,得到人体的人体关键点集合。
比如,电子设备可获取拍摄场景的预览图像,并对该预览图像中的对象进行识别,以确认出该预览图像中是否存在单个人体。当该预览图像中存在单个人体时,电子设备可利用预先训练好的人像检测模型对该预览图像进行人像检测,得到人体边界框。电子设备可基于该人体边界框从预览图像中裁切出人体图像。电子设备可利用预先训练好的关键点检测模型对人体图像进行关键点检测,得到预览图像中的人体的人体关键点集合。
可以理解的是,当该预览图像中不存在人体或存在多个人体时,电子设备可结束流程。
在一实施例中,“确定与拍摄场景对应的构图关键点集合”,包括:
(1)将预览图像划分为前景图像和背景图像;
(2)确定背景图像对应的多个候选关键点集合;
(3)确定拍摄场景中的人体的人体类型;
(4)将多个候选关键点集合中与人体类型对应的候选关键点集合确定为与拍摄场景对应的构图关键点集合。
比如,电子设备可利用预先训练好的场景识别模型对预览图像进行场景识别,得到场景识别结果。电子设备可根据场景识别结果将预览图像划分为前景图像和背景图像。场景识别结果可以包括图像的前景标签以及图像的背景标签,电子设备可根据前景标签以及背景标签将预览图像划分为前景图像和背景图像。
其中,前景标签用于描述预览图像中处于显著位置,且可以用矩形框进行标识的对象。背景标签用于描述预览图像的整体信息,如背景标签可以为“山景”、“水景”、“雪景”、“雨景”等,如前景标签可以为“人”、“猫”、“狗”等。例如,对于一个“人站立于湖水边”的预览图像,前景标签可以为“人”,背景标签可以为“水景”,则前景图像可以为包含“人”的图像,背景图像可以为“水景”图像。
需要说明的是,电子设备中可预置多个不同的预置背景图像,并为每个预置背景图像设置多个不同的候选关键点集合。其中,预置背景图像可以为“水景”图像、“山景”图像、“雪景”图像等。每个候选关键点集合可以包括:鼻子、左眼、右眼、左耳、右耳、脖子、左肩、右肩、左肘、右肘、左手腕、右手腕、左臀、右臀、左膝盖、右膝盖、左脚踝、右脚踝等候选关键点中的一种或多种。
在将预览图像划分为前景图像和背景图像之后,电子设备可获取多个预置背景图像。随后,电子设备可判断多个预置背景图像中是否存在与该背景图像匹配的预置背景图像。其中,假设背景图像为“水景”图像,预置背景图像中也存在“水景”图像,电子设备可判定多个预置背景图像中存在与该背景图像匹配的预置背景图像。当判定多个预置背景图像中存在与该背景图像匹配的预置背景图像时,电子设备可获取与该背景图像匹配的预置背景图像对应的多个候选关键点集合,并将其作为背景图像对应的多个候选关键点集合。之后,电子设备可确定拍摄场景中的人体的人体类型。然后,电子设备可将多个候选关键点集合中与该人体类型对应的候选关键点集合确定为与拍摄场景对应的构图关键点集合。
可以理解的是,电子设备在为每个预置背景图像设置多个不同的候选关键点集合时,电子设备还可为每个预置背景图像对应的每个候选关键点集合设置对应的类型。例如,若某个候选关键点集合包括鼻子、左眼、右眼、左耳、右耳、脖子、左肩、右肩等人体胸部以上的关键点时,电子设备可确定该候选关键点集合对应的类型为胸像类型。若某个候选关键点集合包括鼻子、左眼、右眼、左耳、右耳、脖子、左肩、右肩、左肘、右肘、左手腕、右手腕、左臀、右臀、左膝盖、右膝盖、左脚踝、右脚踝等人体上半身以及人体下半身的关键点时,电子设备可确定该候选关键点集合对应的类型为全身像类型。在确定出人体类型之后,电子设备可获取背景图像对应的每个候选关键点集合对应的类型,得到多个类型。然后,电子设备可从多个类型中确定出与该人体类型匹配的类型,并将与该人体类型匹配的类型对应的候选关键点集合确定为与人体类型对应的候选关键点集合。例如,假设人体类型为全身像类型,多个类型中包括胸像类型和全身像类型。那么,电子设备可将多个类型中全身像类型对应的候选关键点集合确定为与人体类型对应的候选关键点集合。
在一实施例中,本申请实施例提供的拍照方法,还可以包括:
(1)当与人体类型对应的候选关键点集合有多个时,对于每个与人体类型对应的候选关键点集合,获取其对应的构图边界框;
(2)将多个与人体类型对应的候选关键点集合中构图边界框与人体边界框匹配的候选关键点集合确定为与拍摄场景对应的构图关键点集合。
可以理解的是,可能存在与人体类型对应的候选关键点集合有多个的情况。例如,人体类型为全身像类型,候选关键点集合K1和候选关键点集合K2对应的类型均是全身像类型,仅仅只是候选关键点集合K1和候选关键点集合K2各自所包括的候选关键点在屏幕坐标系中所处的位置不同,那么与人体类型对应的候选关键点集合包括候选关键点集合K1和候选关键点集合K2。
在本申请实施例中,电子设备在为每个预置背景图像设置多个不同的候选关键点集合时,电子设备还可为每个预置背景图像设置多个不同的构图边界框。其中,每个候选关键点集合对应一个构图边界框。当与人体类型对应的候选关键点集合有多个时,对于每个与人体类型对应的候选关键点集合,电子设备可获取其对应的构图边界框。随后,电子设备可将多个与人体类型对应的候选关键点集合中构图边界框与人体边界框匹配的候选关键点集合确定为与拍摄场景对应的构图关键点集合。
其中,某个候选关键点集合对应的构图边界框的高度与人体边界框的高度的差值处于预设第一差值范围内,且该候选关键点集合对应的构图边界框的宽度与人体边界框的宽度的差值处于预设第二差值范围内时,电子设备可判定该候选关键点集合对应的构图边界框与人体边界框匹配。其中,预设第一差值范围和预设第二差值范围可预先存储于电子设备。
在一些实施例中,当多个与人体类型对应的候选关键点集合中构图边界框与人体边界框匹配的候选关键点集合,记为第一候选关键点集合有多个时,电子设备还可以获取每个第一候选关键点集合对应的构图边界框的左上角坐标,并获取人体边界框的左上角坐标,并将多个第一候选关键点集合中构图边界框的左上角坐标与人体边界框的左上角坐标相同的第一候选关键点集合确定为与拍摄场景对应的构图 关键点集合。
在另一些实施例中,当多个第一候选关键点集合中构图边界框的左上角坐标与人体边界框的左上角坐标相同的第一候选关键点集合,记为第二候选关键点集合有多个时,电子设备还可以获取每个第二候选关键点集合对应的构图边界框的右下角坐标,并获取人体边界框的右下角坐标,并将多个第二候选关键点集合中构图边界框的右下角坐标与人体边界框的右下角坐标相同的第二候选关键点集合确定为与拍摄场景对应的构图关键点集合。
在一些实施例中,电子设备可预置一构图数据库。构图数据库可以定义为一个哈希表。哈希表是根据键(Key)而直接访问在内存存储位置的数据结构,称为值(Value)。也就是说,它通过计算一个关于键值的函数,将所需查询的数据映射到表中一个位置来访问记录。构图数据库中,键指的是各预置背景图像,如“水景”图像、“山景”图像、“雪景”图像等。值指的是各预置背景图像对应的候选关键点集合和构图边界框。一个预置背景图像可对应多个候选关键点集合和多个构图边界框,其中,每个预置背景图像对应的每个候选关键点集合均与每个预置背景图像对应的一个构图边界框对应。
在实际应用中,当电子设备将预览图像划分为前景图像和背景图像之后,电子设备可获取与该背景图像匹配的预置背景图像,如该背景图像为“水景”图像,与该背景图像匹配的预置背景图像也为“水景”图像。电子设备可将与该背景图像匹配的预置背景图像作为键。电子设备可通过该键在构图数据库中查找到其映射的多个候选关键点集合和多个构图边界框,并将多个该候选关键点集合和多个构图边界框作为该背景图像对应的多个候选关键点集合和多个构图边界框。
在一实施例中,“确定与拍摄场景对应的构图关键点集合”之后,还可以包括:
(1)计算每个人体关键点与对应的构图关键点之间的距离,得到多个距离;
(2)计算多个距离的平均距离;
“人体关键点集合与构图关键点集合不匹配”,包括:平均距离大于或等于预设平均距离。
比如,假设人体关键点集合包括:鼻子N1、左眼LE1、右眼RE1;构图关键点集合包括:鼻子N2、左眼LE2、右眼RE2。电子设备可计算鼻子N1与鼻子N2之间的距离L1、左眼LE1与左眼LE2之间的距离L2以及右眼RE1与右眼RE2之间的距离L3;随后,电子设备可计算距离L1、L2和L3的平均距离。当平均距离大于或等于预设平均距离时,电子设备可判定人体关键点集合与构图关键点集合不匹配。可以理解的是,当平均距离小于预设平均距离时,电子设备可判定人体关键点集合与构图关键点集合匹配。其中,预设平均距离可以根据实际情况预先存储于电子设备中,此处不作具体限制。
在一实施例中,“生成并输出调整电子设备的姿态的提示信息”,包括:
(1)生成多个候选向量;
(2)预测按照每个候选向量调整电子设备的姿态之后所得到的目标人体关键点集合;
(3)将多个候选向量中目标人体关键点集合与构图关键点集合匹配的候选向量确定为目标向量;
(4)根据目标向量生成并输出调整电子设备的姿态的提示信息。
比如,当人体关键点集合与构图关键点集合不匹配时,电子设备可随机地生成多个候选向量。其中,候选向量可以包括大小和方向。例如,候选向量的大小可以为1厘米,方向为水平向右。随后,电子设备可预测按照每个候选向量调整电子设备的姿态之后所得到的目标人体关键点集合。例如,假设某候选向量的大小为1厘米,方向为水平向右,那么,电子设备可预测当用户将电子设备水平向右移动1厘米之后,电子设备对当前拍摄场景中的人体进行关键点检测,得到的目标人体关键点集合。对于每个候选向量对应的目标人体关键点集合,电子设备可检测其是否与构图关键点集合匹配。当某个候选向量对应的目标人体关键点集合与构图关键点集合匹配时,电子设备可将该候选向量确定为目标向量。随后,电子设备可根据目标向量生成并输出调整电子设备的姿态的提示信息。例如,假设目标向量的大小为1厘米,方向为水平向右,那么,电子设备可在显示屏上显示:请将电子设备水平向右移动1厘米。电子设备还可在显示屏上显示一进度条,该进度条的长度与1厘米对应,该进度条可随着电子设备不断向右移动而慢慢变短;该进度条可随着电子设备不断向左移动而慢慢变长。当电子设备移动1厘米时,该进度条也随之消失,因此,用户可根据进度条是否消失来确认是否已将电子设备移动1厘米。
在一实施例中,“确定与拍摄场景对应的构图关键点集合”之后,还可以包括:
(1)从人体关键点集合中确定人脸关键点集合;
(2)获取每个人脸关键点的横坐标,得到多个第一横坐标;
(3)计算多个第一横坐标的第一均值;
(4)当第一均值处于预设均值范围内时,从构图关键点集合中确定与人脸关键点集合对应的目标构图关键点集合;
“人体关键点集合与构图关键点集合不匹配”,可以包括:人脸关键点集合与目标构图关键点集合不匹配。
比如,当从人体关键点集合中选取出的部分人体关键点集合满足预设条件时,电子设备可通过判断该部分人体关键点集合与构图关键点集合中的部分构图关键点集合是否匹配来判断人体关键点集合与构图关键点集合是否匹配。
比如,当得到人体关键点集合和构图关键点集合之后,电子设备可从人体关键点集合中确定人脸关键点集合,如鼻子N1、左眼LE1和右眼RE1。随后,电子设备可获取每个人脸关键点在屏幕坐标系中的横坐标,得到多个第一横坐标。接着,电子设备可计算该多个第一横坐标的第一均值。当该第一均值处于预设均值范围内时,电子设备可从构图关键点集合中确定与人脸关键点集合对应的目标构图关键点集合,如鼻子N2、左眼LE2和右眼RE2。随后,电子设备可检测该人脸关键点集合与该目标构图关键点集合是否匹配。若不匹配,电子设备可判定人体关键点集合与构图关键点集合不匹配。若匹配,电子设备可判定人体关键点集合与构图关键点集合匹配。预设均值范围可根据实际情况预先存储于电子设备中。
在一实施例中,“从构图关键点集合中确定与人脸关键点集合对应的目标构图关键点集合”之后,还可以包括:
(1)获取每个人脸关键点的纵坐标,得到多个第一纵坐标,并获取每个目标构图关键点的横坐标和纵坐标,得到多个第二横坐标和多个第二纵坐标;
(2)计算多个第一纵坐标的第二均值、多个第二横坐标的第三均值,以及多个第二纵坐标的第四均值;
(3)根据第一均值和第二均值,确定第一目标坐标,并根据第三均值和第四均值,确定第二目标坐标;
(4)计算第一目标坐标与第二目标坐标之间的第一距离;
“人脸关键点集合与目标构图关键点集合不匹配”,可以包括:第一距离大于或等于第一预设距离。
例如,假设人脸关键点集合包括鼻子N1、左眼LE1和右眼RE1,目标构图关键点集合包括鼻子N2、左眼LE2和右眼RE2。假设鼻子N1的横坐标为1,纵坐标为2;左眼LE1的横坐标为4,纵坐标为1;右眼RE1的横坐标为4,纵坐标为3;鼻子N2的横坐标为3,纵坐标为3;左眼LE2的横坐标为6,纵坐标为2;右眼RE2的横坐标为6,纵坐标为4;第一预设距离为2。则第一均值为3,第二均值为2,第三均值为5,第四均值为3。第一目标坐标为(3,2),第二目标坐标为(5,3)。第一目标坐标与第二目标坐标之间的第一距离为
可以确定,该第一距离大于第一预设距离,那么电子设备可以判定人脸关键点集合与目标构图关键点集合不匹配,从而可以判定人体关键点集合与构图关键点集合不匹配。其中,鼻子N1、左眼LE1、右眼RE1、鼻子N2、左眼LE2和右眼RE2各自的横坐标和纵坐标均为屏幕坐标系中的坐标。第一预设距离可根据实际情况预先存储于电子设备中。
在一实施例中,“生成并输出调整电子设备的姿态的提示信息”,包括:
(1)根据第一目标坐标和第二目标坐标确定第一移动方向;
(2)根据第一移动方向和第一距离生成并输出调整电子设备的姿态的提示信息。
可以理解的是,该第一移动方向可以为由第一目标坐标指向第二目标坐标的方向。假设该第一移动方向为水平向右的方向,第一距离为
则电子设备可在显示屏上显示:请水平向右移动电子设备。 同时,电子设备还可在显示屏上显示一进度条,该进度条与第一距离对应,该进度条可随着电子设备不断向右移动而慢慢变短;该进度条可随着电子设备不断向左移动而慢慢变长。当电子设备移动第一距离时,该进度条也随之消失,因此,用户可根据进度条是否消失来确认是否何时停止移动电子设备。
在一实施例中,“计算多个第一横坐标的第一均值”之后,还可以包括:
(1)当第一均值不处于预设均值范围内时,检测人体关键点集合中是否存在预设关键点;
(2)若人体关键点集合中不存在预设关键点,则获取人体边界框的第一中心坐标,以及构图关键点集合对应的构图边界框的第二中心坐标;
(3)计算第一中心坐标与第二中心坐标之间的第二距离;
“人体关键点集合与构图关键点集合不匹配”,可以包括:第二距离大于或等于第二预设距离。
比如,当第一均值不处于预设均值范围内时,电子设备还可检测人体关键点集合中是否存在预设关键点。若人体关键点集合中不存在预设关键点,电子设备可获取人体边界框的中心坐标,即第一中心坐标,以及构图关键点集合对应的构图边界框的中心坐标,即第二中心坐标。随后,电子设备可计算第一中心坐标与第二中心坐标之间的第二距离。当第二距离大于或等于第二预设距离时,电子设备可判定人体关键点集合与构图关键点集合不匹配。当第二距离小于第二预设距离时,电子设备可判定人体关键点集合与构图关键点集合匹配。其中,第一中心坐标和第二中心坐标均为屏幕坐标系中的坐标。第二预设距离可根据实际情况预先存储于电子设备中。预设关键点可包括左膝盖、右膝盖、左脚踝、右脚踝等。
例如,当人体关键点集合中不存在预设关键点时,假设第一中心坐标为(1,1),第二中心坐标为(3,3),第二预设距离为2。可以确定,第二距离为
该第二距离大于第二预设距离,因此,电子设备可判定人体关键点集合与构图关键点集合不匹配。
在一实施例中,“生成并输出调整电子设备的姿态的提示信息”,包括:
(1)根据第一中心坐标和第二中心坐标确定第二移动方向;
(2)根据第二移动方向和第二距离生成并输出调整电子设备的姿态的提示信息。
可以理解的是,该第二移动方向可以为由第一中心坐标指向第二中心坐标的方向。假设该第二移动方向为水平向右的方向,第二距离为
则电子设备可在显示屏上显示:请水平向右移动电子设备。同时,电子设备还可在显示屏上显示一进度条,该进度条与第二距离对应,该进度条可随着电子设备不断向右移动而慢慢变短;该进度条可随着电子设备不断向左移动而慢慢变长。当电子设备移动第二距离时,该进度条也随之消失,因此,用户可根据进度条是否消失来确认是否何时停止移动电子设备。
在一实施例中,“检测人体关键点集合中是否存在预设关键点”之后,还可以包括:
(1)若人体关键点集合中存在预设关键点,则获取人体边界框的第一中心横坐标,以及构图关键点集合对应的构图边界框的第二中心横坐标;
(2)从构图关键点集合中确定与人脸关键点集合对应的目标构图关键点集合;
(3)获取每个人脸关键点的纵坐标,得到多个第三纵坐标,并获取每个目标构图关键点的纵坐标,得到多个第四纵坐标;
(4)计算多个第三纵坐标的第五均值,以及多个第四纵坐标的第六均值;
(5)根据第一中心横坐标和第五均值,确定第三目标坐标,并根据第二中心横坐标和第六均值,确定第四目标坐标;
(6)计算第三目标坐标与第四目标坐标之间的第三距离;
“人体关键点集合与构图关键点集合不匹配”,可以包括:第三距离大于或等于第三预设距离。
例如,当人体关键点集合中存在预设关键点时,假设人脸关键点集合包括鼻子N1、左眼LE1和右眼RE1,目标构图关键点集合包括鼻子N2、左眼LE2和右眼RE2。假设鼻子N1的纵坐标为2;左眼LE1的纵坐标为1;右眼RE1的纵坐标为3;鼻子N2的纵坐标为3;左眼LE2的纵坐标为2;右眼RE2的纵坐标为4;人体边界框的第一中心横坐标为2;构图关键点集合对应的构图边界框的第二中心横坐 标为4;预设第三距离为2。则第五均值为2,第六均值为3。第三目标坐标为(2,2),第四目标坐标为(4,3)。第三目标坐标与第四目标坐标之间的第三距离为
可以确定,该第三距离大于第三预设距离,那么电子设备可以判定人体关键点集合与构图关键点集合不匹配。可以理解,若第三距离小于预设距离,则电子设备可判定人体关键点集合与构图关键点集合匹配。其中,人体边界框的第一中心横坐标为人体边界框的中心在屏幕坐标系中的横坐标,构图关键点集合对应的构图边界框的第二中心横坐标为构图关键点集合对应的构图边界框的中心在屏幕坐标系中的横坐标。预设第三距离可根据实际情况存储于电子设备中。预设关键点可包括左膝盖、右膝盖、左脚踝、右脚踝等。
在一实施例中,“生成并输出调整电子设备的姿态的提示信息”,包括:
(1)根据第三目标坐标和第四目标坐标确定第三移动方向;
(2)根据第三移动方向和第三距离生成并输出调整电子设备的姿态的提示信息。
可以理解的是,该第三移动方向可以为由第三目标坐标指向第四目标坐标的方向。假设该第三移动方向为水平向右的方向,第三距离为
则电子设备可在显示屏上显示:请水平向右移动电子设备。同时,电子设备还可在显示屏上显示一进度条,该进度条与第三距离对应,该进度条可随着电子设备不断向右移动而慢慢变短;该进度条可随着电子设备不断向左移动而慢慢变长。当电子设备移动第三距离时,该进度条也随之消失,因此,用户可根据进度条是否消失来确认是否何时停止移动电子设备。
在一实施例中,“对拍摄场景中的人体进行关键点检测,得到该人体的人体关键点集合”之前,还可以包括:
(1)检测电子设备是否处于预设状态;
(2)若电子设备处于预设状态,则执行对拍摄场景中的人体进行关键点检测,得到该人体的人体关键点集合;
(3)若电子设备不处于预设状态,则生成并输出调整电子设备的状态的提示信息;
(4)当调整后的电子设备处于预设状态时,执行对拍摄场景中的人体进行关键点检测,得到人体的人体关键点集合。
比如,预设状态可以为水平状态。为了拍摄出更美观的照片,在对拍摄场景中的人体进行关键点检测,得到人体的人体关键点集合之前,电子设备还可通过陀螺仪传感器等方位传感器获取电子设备的Pitch俯仰角和Roll翻转角。然后通过该Pitch俯仰角和Roll翻转角判断电子设备是否处于水平状态。若该Pitch俯仰角和该Roll翻转角均为180度,电子设备可判定电子设备处于水平状态,那么,电子设备可对拍摄场景中的人体进行关键点检测,得到人体的人体关键点集合。若该Pitch俯仰角不为180度,或该Roll翻转角不为180度,电子设备可判定电子设备不处于水平状态。电子设备可生成并输出调整电子设备的状态的提示信息。例如,该提示信息可以为:请使电子设备处于水平状态。当用户调整电子设备的状态时,电子设备也可持续检测所获取到的Pitch俯仰角和Roll翻转角是否为180度。当检测到所获取到的Pitch俯仰角和Roll翻转角为180度时,电子设备可生成一提示信息,该提示信息用于提示用户停止对电子设备的状态进行调整。当调整后的电子设备处于水平状态时,电子设备可对拍摄场景中的人体进行关键点检测,得到人体的人体关键点集合。
又比如,预设状态可以为垂直状态。为了拍摄出更美观的照片,在对拍摄场景中的人体进行关键点检测,得到人体的人体关键点集合之前,电子设备还可通过陀螺仪传感器等方位传感器获取电子设备的Pitch俯仰角和Roll翻转角。然后通过该Pitch俯仰角和Roll翻转角判断电子设备是否处于垂直状态。若该Pitch俯仰角和该Roll翻转角均为90度,电子设备可判定电子设备处于垂直状态,那么,电子设备可对拍摄场景中的人体进行关键点检测,得到人体的人体关键点集合。若该Pitch俯仰角不为90度,或该Roll翻转角不为90度,电子设备可判定电子设备不处于垂直状态。电子设备可生成并输出调整电子设备的状态的提示信息。例如,该提示信息可以为:请使电子设备处于垂直状态。当用户调整电子设备的状态时,电子设备也可持续检测所获取到的Pitch俯仰角和Roll翻转角是否为90度。当检测到所获取到 的Pitch俯仰角和Roll翻转角为90度时,电子设备可生成一提示信息,该提示信息用于提示用户停止对电子设备的姿态进行调整。当调整后的电子设备处于垂直状态时,电子设备可对拍摄场景中的人体进行关键点检测,得到人体的人体关键点集合。
可以理解的是,调整电子设备的状态可以为使得电子设备相对于地面处于水平状态或垂直状态。调整电子设备的姿态可以为在电子设备处于任意状态(包括水平状态或垂直状态)的基础上,将电子设备相对于用户水平向前、水平向后、水平向左、水平向右、垂直向上、垂直向下移动等。
请参阅图2,图2是本申请实施例提供的拍照方法的第二种流程示意图,该拍照方法可应用于电子设备中,该流程可以包括:
201、电子设备获取拍摄场景的预览图像。
比如,如图3所示,电子设备可获取拍摄场景的预览图像G1。
其中,电子设备在根据用户操作启动拍摄类应用程序(比如电子设备的系统应用“相机”)后,其摄像头所对准的场景即为拍摄场景。
202、电子设备利用人像检测模型对预览图像进行人像检测,得到人体边界框。
比如,如图4所示,当得到预览图像G1之后,电子设备可利用预先训练好的人像检测模型对预览图像G1进行人像检测,得到人体边界框B1。
需要说明的是,当电子设备利用人像检测模型对预览图像进行人像检测,得到的人体边界框有多个,或未得到人体边界框时,电子设备可直接结束流程。
203、电子设备基于人体边界框从预览图像中裁切出人体图像。
比如,如图5所示,当得到人体边界框B1之后,电子设备可沿着人体边界框对预览图像进行裁切,以从预览图像中裁切出人体图像G2。
204、电子设备利用关键点检测模型对人体图像进行关键点检测,得到人体的人体关键点集合。
比如,当得到人体图像G2之后,电子设备可利用预先训练好的关键点检测模型对人体图像G2进行关键点检测,得到人体的人体关键点集合。其中,人体关键点集合可以包括:鼻子、左眼、右眼、左耳、右耳、脖子、左肩、右肩、左肘、右肘、左手腕、右手腕、左臀、右臀、左膝盖、右膝盖、左脚踝、右脚踝等人体关键点中的一种或多种。
205、电子设备将预览图像划分为前景图像和背景图像。
在本申请实施例中,在电子设备获取拍摄场景的预览图像之前,电子设备还可以获取多个图像样本,并获取每个图像样本的前景标签和背景标签。随后,电子设备可利用多个图像样本,以及每个图像样本的前景标签和背景标签对卷积神经网络等深度学习模型进行训练,得到训练好的模型,该训练好的模型可作为场景识别模型。
其中,前景标签用于描述图像样本中处于显著位置,且可以用矩形框进行标识的对象。背景标签用于描述图像样本的整体信息,如背景标签可以为“山景”、“水景”、“雪景”、“雨景”等,如前景标签可以为“人”、“猫”、“狗”等。例如,对于一个“人站立于湖水边”的图像样本,前景标签可以为“人”,背景标签可以为“水景”。
比如,在得到预览图像G1之后,电子设备可利用预先训练好的场景识别模型对预览图像G1进行场景识别,以得到该预览图像G1的前景标签和背景标签,从而根据该预览图像G1的前景标签和背景标签将预览图像G1划分为前景图像和背景图像。对于该预览图像G1,电子设备识别出该预览图像的背景标签为“山景”,那么,该背景图像即为“山景”图像;电子设备识别出该预览图像的前景标签为“人”,那么,该前景图像即为包含“人”的图像。
206、电子设备确定背景图像对应的多个候选关键点集合。
可以理解的是,在本申请实施例中,电子设备中可预置多个不同的预置背景图像,并为每个预置背景图像设置多个不同的、构图合理的候选关键点集合。其中,预置背景图像可以为“水景”图像、“山景”图像、“雪景”图像等。每个候选关键点集合可包括:鼻子、左眼、右眼、左耳、右耳、脖子、左肩、右肩、左肘、右肘、左手腕、右手腕、左臀、右臀、左膝盖、右膝盖、左脚踝、右脚踝等候选关键 点中的一种或多种。
比如,在将预览图像G1划分为前景图像和背景图像之后,电子设备可获取多个预置背景图像。随后,电子设备可判断多个预置背景图像中是否存在与该背景图像匹配的预置背景图像。其中,假设背景图像为“山景”图像,预置背景图像中也存在“山景”图像,电子设备可判定多个预置背景图像中存在与该背景图像匹配的预置背景图像。当判定多个预置背景图像中存在与该背景图像匹配的预置背景图像时,电子设备可获取与该背景图像匹配的预置背景图像对应的多个候选关键点集合,并将其作为背景图像对应的多个候选关键点集合。
207、电子设备确定人体的人体类型。
208、电子设备将多个候选关键点集合中与人体类型对应的候选关键点集合确定为与拍摄场景对应的构图关键点集合。
在本申请实施例中,当得到背景图像对应的多个候选关键点集合时,电子设备可确定拍摄场景中的人体的人体类型。然后,电子设备可将多个候选关键点集合中与该人体类型对应的候选关键点集合确定为与拍摄场景对应的构图关键点集合。
可以理解的是,电子设备在为每个预置背景图像设置多个不同的候选关键点集合时,电子设备还可为每个预置背景图像对应的每个候选关键点集合设置对应的类型。例如,若某个候选关键点集合包括鼻子、左眼、右眼、左耳、右耳、脖子、左肩、右肩等人体胸部以上的关键点时,电子设备可确定该候选关键点集合对应的类型为胸像类型。若某个候选关键点集合包括鼻子、左眼、右眼、左耳、右耳、脖子、左肩、右肩、左肘、右肘、左手腕、右手腕、左臀、右臀、左膝盖、右膝盖、左脚踝、右脚踝等人体上半身以及人体下半身的关键点时,电子设备可确定该候选关键点集合对应的类型为全身像类型。在确定出人体类型之后,电子设备可获取背景图像对应的每个候选关键点集合对应的类型,得到多个类型。然后,电子设备可从多个类型中确定出与该人体类型匹配的类型,并将与该人体类型匹配的类型对应的候选关键点集合确定为与人体类型对应的候选关键点集合。该与人体类型对应的候选关键点集合可作为与拍摄场景对应的构图关键点集合。例如,假设人体类型为全身像类型,多个类型中包括胸像类型和全身像类型。那么,电子设备可将多个类型中全身像类型对应的候选关键点集合确定为与人体类型对应的候选关键点集合。该与人体类型对应的候选关键点集合可作为与拍摄场景对应的构图关键点集合。
209、电子设备计算每个人体关键点与对应的构图关键点之间的距离,得到多个距离。
210、电子设备计算多个距离的平均距离。
比如,当得到人体关键点集合和构图关键点集合之后,电子设备可计算每个人体关键点与对应的构图关键点之间的距离,得到多个距离。例如,假设人体关键点集合包括:鼻子N1、左眼LE1、右眼RE1、左耳LA1、右耳RA1、脖子K1;构图关键点集合包括:鼻子N2、左眼LE2、右眼RE2、左耳LA2、右耳RA2、脖子K2。电子设备可计算鼻子N1与鼻子N2之间的距离L1。假设鼻子N1为(1,2),鼻子N2为(3,3),则鼻子N1与鼻子N2之间的距离L1为
以此类推,电子设备可按照上述方式计算左眼LE1与左眼LE2之间的距离L2;右眼RE1与右眼RE2之间的距离L3;左耳LA1与左耳LA2之间的距离L4、右耳RA1与右耳RA2之间的距离L5;脖子K1与脖子K2之间的距离L6。
211、当平均距离大于或等于预设平均距离时,电子设备生成并输出调整电子设备的姿态的提示信息。
比如,当得到平均距离之后,电子设备可判断该平均距离是否大于或等于预设平均距离。若该平均距离大于或等于预设平均距离,电子设备可生成并输出调整电子设备的姿态的提示信息,以使用户根据该提示信息调整电子设备的姿态,从而使得调整电子设备的姿态之后,电子设备所得到的实时平均距离小于预设平均距离。其中,预设平均距离可预先存储于电子设备中。
可以理解的是,随着电子设备的姿态的不断变化,拍摄场景也随之不断变化。随着拍摄场景的不断变化,对拍摄场景中的人体进行关键点检测,得到的人体关键点集合中的人体关键点的位置也会变化。随着人体关键点的位置的不断变化,每个人体关键点与对应的构图关键点之间的距离也会不断变化。随着该距离的不断变化,电子设备所计算出的平均距离也会不断变化。该不断变化的平均距离即为实时平均距离。
例如,在该平均距离大于或等于预设平均距离时,电子设备可生成多个候选向量。其中,候选向量可以包括大小和方向。例如,候选向量的大小可以为1厘米,方向为水平向右。
随后,电子设备可预测按照每个候选向量调整电子设备的姿态之后所得到的目标人体关键点集合。例如,假设某候选向量的大小为1厘米,方向为水平向右,那么,电子设备可预测当用户将电子设备水平向右移动1厘米之后,电子设备对当前拍摄场景中的人体进行关键点检测,得到的目标人体关键点集合。对于每个候选向量对应的每个目标人体关键点,电子设备可计算其与对应的构图关键点之间的距离,得到每个候选向量对应的多个距离。随后,电子设备可计算每个候选向量对应的多个距离的平均距离;最后,电子设备可将多个候选向量中平均距离小于预设平均距离的候选向量确定为目标向量。
接着,电子设备可根据目标向量生成并输出调整电子设备的姿态的提示信息。例如,如图6所示,假设目标向量的大小为1厘米,方向为水平向右,那么,电子设备可在显示屏上显示:请水平向右移动电子设备。电子设备还可在显示屏上显示一进度条,该进度条的长度与1厘米对应,该进度条可随着电子设备不断向右移动而慢慢变短;该进度条可随着电子设备不断向左移动而慢慢变长。当电子设备移动1厘米时,该进度条也随之消失,因此,用户可根据进度条是否消失来确认何时停止移动电子设备。
212、当实时平均距离小于预设平均距离时,电子设备对拍摄场景进行拍摄,得到目标图像。
如图7所示,在本申请实施例中,当实时平均距离小于预设平均距离时,电子设备可对拍摄场景进行拍摄,从而得到符合一定美学规则、构图合理的图像,即目标图像G3。或者,当实时平均距离小于预设平均距离时,电子设备可生成一提示信息,以提示用户对拍摄场景进行拍摄。那么,用户可点击拍摄类应用程序界面中的“拍摄”按钮,以对拍摄场景进行拍摄,得到符合一定美学规则的目标图像G3。
可以理解的是,当通过流程210所得到的平均距离小于预设平均距离时,电子设备可直接对拍摄场景进行拍摄,以得到符合一定美学规则,即构图合理的图像。
请参阅图8,图8为本申请实施例提供的拍照装置的结构示意图。该拍照装置可应用于电子设备,该拍照装置300包括:检测模块301,确定模块302,生成模块303及拍摄模块304。
检测模块301,用于对拍摄场景中的人体进行关键点检测,得到所述人体的人体关键点集合。
确定模块302,用于确定与所述拍摄场景对应的构图关键点集合。
生成模块303,用于当所述人体关键点集合与所述构图关键点集合不匹配时,生成并输出调整电子设备的姿态的提示信息。
拍摄模块304,用于当所述人体的实时人体关键点集合与所述构图关键点集合匹配时,对拍摄场景进行拍摄,得到目标图像。
在一些实施例中,检测模块301,可以用于:获取拍摄场景的预览图像;利用人像检测模型对所述预览图像进行人像检测,得到人体边界框;基于所述人体边界框从所述预览图像中裁切出人体图像;利用关键点检测模型对所述人体图像进行关键点检测,得到所述人体的人体关键点集合。
在一些实施例中,确定模块302,可以用于:将所述预览图像划分为前景图像和背景图像;确定所述背景图像对应的多个候选关键点集合;确定所述人体的人体类型;将所述多个候选关键点集合中与所述人体类型对应的候选关键点集合确定为与所述拍摄场景对应的构图关键点集合。
在一些实施例中,确定模块302,可以用于:当与所述人体类型对应的候选关键点集合有多个时,对于每个与所述人体类型对应的候选关键点集合,获取其对应的构图边界框;将多个与所述人体类型对应的候选关键点集合中构图边界框与所述人体边界框匹配的候选关键点集合确定为与所述拍摄场景对应的构图关键点集合。
在一些实施例中,确定模块302,可以用于:计算每个人体关键点与对应的构图关键点之间的距离, 得到多个距离;计算所述多个距离的平均距离;
生成模块303,可以用于:当所述平均距离大于或等于预设平均距离时,生成并输出调整电子设备的姿态的提示信息。
在一些实施例中,生成模块303,可以用于:生成多个候选向量;预测按照每个候选向量调整电子设备的姿态之后所得到的目标人体关键点集合;将多个候选向量中目标人体关键点集合与所述构图关键点集合匹配的候选向量确定为目标向量;根据所述目标向量生成并输出调整电子设备的姿态的提示信息。
在一些实施例中,确定模块302,可以用于:从所述人体关键点集合中确定人脸关键点集合;获取每个人脸关键点的横坐标,得到多个第一横坐标;计算所述多个第一横坐标的第一均值;当所述第一均值处于预设均值范围内时,从所述构图关键点集合中确定与所述人脸关键点集合对应的目标构图关键点集合;
生成模块303,可以用于:当所述人脸关键点集合与所述目标构图关键点集合不匹配时,生成并输出调整电子设备的姿态的提示信息。
在一些实施例中,确定模块302,可以用于:获取每个人脸关键点的纵坐标,得到多个第一纵坐标,并获取每个目标构图关键点的横坐标和纵坐标,得到多个第二横坐标和多个第二纵坐标;计算所述多个第一纵坐标的第二均值、所述多个第二横坐标的第三均值,以及所述多个第二纵坐标的第四均值;根据所述第一均值和所述第二均值,确定第一目标坐标,并根据所述第三均值和所述第四均值,确定第二目标坐标;计算所述第一目标坐标与所述第二目标坐标之间的第一距离;
生成模块303,可以用于:当所述第一距离大于或等于第一预设距离时,生成并输出调整电子设备的姿态的提示信息。
在一些实施例中,确定模块302,可以用于:当所述第一均值不处于预设均值范围内时,检测所述人体关键点集合中是否存在预设关键点;若所述人体关键点集合中不存在预设关键点,则获取所述人体边界框的第一中心坐标,以及所述构图关键点集合对应的构图边界框的第二中心坐标;计算所述第一中心坐标与所述第二中心坐标之间的第二距离;
生成模块303,可以用于:当所述第二距离大于或等于第二预设距离时,生成并输出调整电子设备的姿态的提示信息。
在一些实施例中,确定模块302,可以用于:若所述人体关键点集合中存在预设关键点,则获取所述人体边界框的第一中心横坐标,以及所述构图关键点集合对应的构图边界框的第二中心横坐标;从所述构图关键点集合中确定与所述人脸关键点集合对应的目标构图关键点集合;获取每个人脸关键点的纵坐标,得到多个第三纵坐标,并获取每个目标构图关键点的纵坐标,得到多个第四纵坐标;计算所述多个第三纵坐标的第五均值,以及所述多个第四纵坐标的第六均值;根据所述第一中心横坐标和所述第五均值,确定第三目标坐标,并根据所述第二中心横坐标和第六均值,确定第四目标坐标;计算所述第三目标坐标与所述第四目标坐标之间的第三距离;
生成模块303,可以用于:当所述第三距离大于或等于第三预设距离时,生成并输出调整电子设备的姿态的提示信息。
本申请实施例提供一种计算机可读的存储介质,其上存储有计算机程序,当所述计算机程序在计算机上执行时,使得所述计算机执行如本实施例提供的拍照方法中的流程。
本申请实施例还提供一种电子设备,包括存储器,处理器,所述处理器通过调用所述存储器中存储的计算机程序,用于执行本实施例提供的拍照方法中的流程。
例如,上述电子设备可以是诸如平板电脑或者智能手机等移动终端。请参阅图9,图9为本申请实施例提供的电子设备的第一种结构示意图。
该电子设备400可以包括摄像模组401、存储器402、处理器403等部件。本领域技术人员可以理解,图9中示出的电子设备结构并不构成对电子设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
摄像模组401可以包括透镜、图像传感器和图像信号处理器,其中透镜用于采集外部的光源信号提 供给图像传感器,图像传感器感应来自于透镜的光源信号,将其转换为数字化的原始图像,即RAW图像,并将该RAW图像提供给图像信号处理器处理。图像信号处理器可以对该RAW图像进行格式转换,降噪等处理,得到YUV图像。其中,RAW是未经处理、也未经压缩的格式,可以将其形象地称为“数字底片”。YUV是一种颜色编码方法,其中Y表示亮度,U表示色度,V表示浓度,人眼从YUV图像中可以直观的感受到其中所包含的自然特征。
存储器402可用于存储应用程序和数据。存储器402存储的应用程序中包含有可执行代码。应用程序可以组成各种功能模块。处理器403通过运行存储在存储器402的应用程序,从而执行各种功能应用以及数据处理。
处理器403是电子设备的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储器402内的应用程序,以及调用存储在存储器402内的数据,执行电子设备的各种功能和处理数据,从而对电子设备进行整体监控。
在本实施例中,电子设备中的处理器403会按照如下的指令,将一个或一个以上的应用程序的进程对应的可执行代码加载到存储器402中,并由处理器403来运行存储在存储器402中的应用程序,从而执行:
对拍摄场景中的人体进行关键点检测,得到所述人体的人体关键点集合;
确定与所述拍摄场景对应的构图关键点集合;
当所述人体关键点集合与所述构图关键点集合不匹配时,生成并输出调整电子设备的姿态的提示信息;
当所述人体的实时人体关键点集合与所述构图关键点集合匹配时,对拍摄场景进行拍摄,得到目标图像。
请参阅图10,电子设备400可以包括摄像模组401、存储器402、处理器403、触摸显示屏404、扬声器405、麦克风406等部件。
摄像模组401可以包括图像处理电路,图像处理电路可以利用硬件和/或软件组件实现,可包括定义图像信号处理(Image Signal Processing)管线的各种处理单元。图像处理电路至少可以包括:摄像头、图像信号处理器(Image Signal Processor,ISP处理器)、控制逻辑器、图像存储器以及显示器等。其中摄像头至少可以包括一个或多个透镜和图像传感器。图像传感器可包括色彩滤镜阵列(如Bayer滤镜)。图像传感器可获取用图像传感器的每个成像像素捕捉的光强度和波长信息,并提供可由图像信号处理器处理的一组原始图像数据。
图像信号处理器可以按多种格式逐个像素地处理原始图像数据。例如,每个图像像素可具有8、10、12或14比特的位深度,图像信号处理器可对原始图像数据进行一个或多个图像处理操作、收集关于图像数据的统计信息。其中,图像处理操作可按相同或不同的位深度精度进行。原始图像数据经过图像信号处理器处理后可存储至图像存储器中。图像信号处理器还可从图像存储器处接收图像数据。
图像存储器可为存储器装置的一部分、存储设备、或电子设备内的独立的专用存储器,并可包括DMA(Direct Memory Access,直接直接存储器存取)特征。
当接收到来自图像存储器的图像数据时,图像信号处理器可进行一个或多个图像处理操作,如时域滤波。处理后的图像数据可发送给图像存储器,以便在被显示之前进行另外的处理。图像信号处理器还可从图像存储器接收处理数据,并对所述处理数据进行原始域中以及RGB和YCbCr颜色空间中的图像数据处理。处理后的图像数据可输出给显示器,以供用户观看和/或由图形引擎或GPU(Graphics Processing Unit,图形处理器)进一步处理。此外,图像信号处理器的输出还可发送给图像存储器,且显示器可从图像存储器读取图像数据。在一种实施方式中,图像存储器可被配置为实现一个或多个帧缓冲器。
图像信号处理器确定的统计数据可发送给控制逻辑器。例如,统计数据可包括自动曝光、自动白平衡、自动聚焦、闪烁检测、黑电平补偿、透镜阴影校正等图像传感器的统计信息。
控制逻辑器可包括执行一个或多个例程(如固件)的处理器和/或微控制器。一个或多个例程可根据接 收的统计数据,确定摄像头的控制参数以及ISP控制参数。例如,摄像头的控制参数可包括照相机闪光控制参数、透镜的控制参数(例如聚焦或变焦用焦距)、或这些参数的组合。ISP控制参数可包括用于自动白平衡和颜色调整(例如,在RGB处理期间)的增益水平和色彩校正矩阵等。
请参阅图11,图11为本实施例中图像处理电路的结构示意图。如图11所示,为便于说明,仅示出与本申请实施例相关的图像处理技术的各个方面。
例如图像处理电路可以包括:摄像头、图像信号处理器、控制逻辑器、图像存储器、显示器。其中,摄像头可以包括一个或多个透镜和图像传感器。在一些实施例中,摄像头可为长焦摄像头或广角摄像头中的任一者。
摄像头采集的第一图像传输给图像信号处理器进行处理。图像信号处理器处理第一图像后,可将第一图像的统计数据(如图像的亮度、图像的反差值、图像的颜色等)发送给控制逻辑器。控制逻辑器可根据统计数据确定摄像头的控制参数,从而摄像头可根据控制参数进行自动对焦、自动曝光等操作。第一图像经过图像信号处理器进行处理后可存储至图像存储器中。图像信号处理器也可以读取图像存储器中存储的图像以进行处理。另外,第一图像经过图像信号处理器进行处理后可直接发送至显示器进行显示。显示器也可以读取图像存储器中的图像以进行显示。
此外,图中没有展示的,电子设备还可以包括CPU和供电模块。CPU和逻辑控制器、图像信号处理器、图像存储器和显示器均连接,CPU用于实现全局控制。供电模块用于为各个模块供电。
存储器402存储的应用程序中包含有可执行代码。应用程序可以组成各种功能模块。处理器403通过运行存储在存储器402的应用程序,从而执行各种功能应用以及数据处理。
处理器403是电子设备的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储器402内的应用程序,以及调用存储在存储器402内的数据,执行电子设备的各种功能和处理数据,从而对电子设备进行整体监控。
触摸显示屏404可以用于接收用户对电子设备的触摸控制操作。扬声器405可以播放声音信号。传感器406可包括陀螺仪传感器、加速度传感器、方向传感器、磁场传感器等,其可用于获取电子设备400的当前姿态。
在本实施例中,电子设备中的处理器403会按照如下的指令,将一个或一个以上的应用程序的进程对应的可执行代码加载到存储器402中,并由处理器403来运行存储在存储器402中的应用程序,从而执行:
对拍摄场景中的人体进行关键点检测,得到所述人体的人体关键点集合;
确定与所述拍摄场景对应的构图关键点集合;
当所述人体关键点集合与所述构图关键点集合不匹配时,生成并输出调整电子设备的姿态的提示信息;
当所述人体的实时人体关键点集合与所述构图关键点集合匹配时,对拍摄场景进行拍摄,得到目标图像。
在一种实施方式中,处理器403执行对拍摄场景中的人体进行关键点检测,得到所述人体的人体关键点集合时,可以执行:获取拍摄场景的预览图像;利用人像检测模型对所述预览图像进行人像检测,得到人体边界框;基于所述人体边界框从所述预览图像中裁切出人体图像;利用关键点检测模型对所述人体图像进行关键点检测,得到所述人体的人体关键点集合。
在一种实施方式中,处理器403执行确定与所述拍摄场景对应的构图关键点集合时,可以执行:将所述预览图像划分为前景图像和背景图像;确定所述背景图像对应的多个候选关键点集合;确定所述人体的人体类型;将所述多个候选关键点集合中与所述人体类型对应的候选关键点集合确定为与所述拍摄场景对应的构图关键点集合。
在一种实施方式中,处理器403还可以执行:当与所述人体类型对应的候选关键点集合有多个时,对于每个与所述人体类型对应的候选关键点集合,获取其对应的构图边界框;将多个与所述人体类型对应的候选关键点集合中构图边界框与所述人体边界框匹配的候选关键点集合确定为与所述拍摄场景对 应的构图关键点集合。
在一种实施方式中,处理器403执行确定与所述拍摄场景对应的构图关键点集合之后,还可以执行:计算每个人体关键点与对应的构图关键点之间的距离,得到多个距离;计算所述多个距离的平均距离;则处理器403执行当所述人体关键点集合与所述构图关键点集合不匹配时,生成并输出调整电子设备的姿态的提示信息时,可以执行:当所述平均距离大于或等于预设平均距离时,生成并输出调整电子设备的姿态的提示信息。
在一种实施方式中,处理器403执行生成并输出调整电子设备的姿态的提示信息时,可以执行:生成多个候选向量;预测按照每个候选向量调整电子设备的姿态之后所得到的目标人体关键点集合;将多个候选向量中目标人体关键点集合与所述构图关键点集合匹配的候选向量确定为目标向量;根据所述目标向量生成并输出调整电子设备的姿态的提示信息。
在一种实施方式中,处理器403执行确定与所述拍摄场景对应的构图关键点集合之后,还可以执行:从所述人体关键点集合中确定人脸关键点集合;获取每个人脸关键点的横坐标,得到多个第一横坐标;计算所述多个第一横坐标的第一均值;当所述第一均值处于预设均值范围内时,从所述构图关键点集合中确定与所述人脸关键点集合对应的目标构图关键点集合;则处理器403执行当所述人体关键点集合与所述构图关键点集合不匹配时,生成并输出调整电子设备的姿态的提示信息时,可以执行:当所述人脸关键点集合与所述目标构图关键点集合不匹配时,生成并输出调整电子设备的姿态的提示信息。
在一种实施方式中,处理器403执行从所述构图关键点集合中确定与所述人脸关键点集合对应的目标构图关键点集合之后,还可以执行:获取每个人脸关键点的纵坐标,得到多个第一纵坐标,并获取每个目标构图关键点的横坐标和纵坐标,得到多个第二横坐标和多个第二纵坐标;计算所述多个第一纵坐标的第二均值、所述多个第二横坐标的第三均值,以及所述多个第二纵坐标的第四均值;根据所述第一均值和所述第二均值,确定第一目标坐标,并根据所述第三均值和所述第四均值,确定第二目标坐标;计算所述第一目标坐标与所述第二目标坐标之间的第一距离;则处理器403执行当所述人体关键点集合与所述构图关键点集合不匹配时,生成并输出调整电子设备的姿态的提示信息时,可以执行:当所述第一距离大于或等于第一预设距离时,生成并输出调整电子设备的姿态的提示信息。
在一种实施方式中,处理器403执行计算所述多个第一横坐标的第一均值之后,还可以执行:当所述第一均值不处于预设均值范围内时,检测所述人体关键点集合中是否存在预设关键点;若所述人体关键点集合中不存在预设关键点,则获取所述人体边界框的第一中心坐标,以及所述构图关键点集合对应的构图边界框的第二中心坐标;计算所述第一中心坐标与所述第二中心坐标之间的第二距离;则处理器403执行当所述人体关键点集合与所述构图关键点集合不匹配时,生成并输出调整电子设备的姿态的提示信息时,可以执行:当所述第二距离大于或等于第二预设距离时,生成并输出调整电子设备的姿态的提示信息。
在一种实施方式中,处理器403执行检测所述人体关键点集合中是否存在预设关键点之后,还可以执行:若所述人体关键点集合中存在预设关键点,则获取所述人体边界框的第一中心横坐标,以及所述构图关键点集合对应的构图边界框的第二中心横坐标;从所述构图关键点集合中确定与所述人脸关键点集合对应的目标构图关键点集合;获取每个人脸关键点的纵坐标,得到多个第三纵坐标,并获取每个目标构图关键点的纵坐标,得到多个第四纵坐标;计算所述多个第三纵坐标的第五均值,以及所述多个第四纵坐标的第六均值;根据所述第一中心横坐标和所述第五均值,确定第三目标坐标,并根据所述第二中心横坐标和第六均值,确定第四目标坐标;计算所述第三目标坐标与所述第四目标坐标之间的第三距离;则处理器403执行当所述人体关键点集合与所述构图关键点集合不匹配时,生成并输出调整电子设备的姿态的提示信息时,可以执行:当所述第三距离大于或等于第三预设距离时,生成并输出调整电子设备的姿态的提示信息。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见上文针对拍照方法的详细描述,此处不再赘述。
本申请实施例提供的所述拍照装置与上文实施例中的拍照方法属于同一构思,在所述拍照装置上可 以运行所述拍照方法实施例中提供的任一方法,其具体实现过程详见所述拍照方法实施例,此处不再赘述。
需要说明的是,对本申请实施例所述拍照方法而言,本领域普通技术人员可以理解实现本申请实施例所述拍照方法的全部或部分流程,是可以通过计算机程序来控制相关的硬件来完成,所述计算机程序可存储于一计算机可读取存储介质中,如存储在存储器中,并被至少一个处理器执行,在执行过程中可包括如所述拍照方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储器(ROM,Read Only Memory)、随机存取记忆体(RAM,Random Access Memory)等。
对本申请实施例的所述拍照装置而言,其各功能模块可以集成在一个处理芯片中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中,所述存储介质譬如为只读存储器,磁盘或光盘等。
以上对本申请实施例所提供的一种拍照方法、装置、存储介质以及电子设备进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。
Claims (20)
- 一种拍照方法,应用于电子设备,其中,包括:对拍摄场景中的人体进行关键点检测,得到所述人体的人体关键点集合;确定与所述拍摄场景对应的构图关键点集合;当所述人体关键点集合与所述构图关键点集合不匹配时,生成并输出调整电子设备的姿态的提示信息;当所述人体的实时人体关键点集合与所述构图关键点集合匹配时,对拍摄场景进行拍摄,得到目标图像。
- 根据权利要求1所述的拍照方法,其中,所述对拍摄场景中的人体进行关键点检测,得到所述人体的人体关键点集合,包括:获取拍摄场景的预览图像;利用人像检测模型对所述预览图像进行人像检测,得到人体边界框;基于所述人体边界框从所述预览图像中裁切出人体图像;利用关键点检测模型对所述人体图像进行关键点检测,得到所述人体的人体关键点集合。
- 根据权利要求2所述的拍照方法,其中,所述确定与所述拍摄场景对应的构图关键点集合,包括:将所述预览图像划分为前景图像和背景图像;确定所述背景图像对应的多个候选关键点集合;确定所述人体的人体类型;将所述多个候选关键点集合中与所述人体类型对应的候选关键点集合确定为与所述拍摄场景对应的构图关键点集合。
- 根据权利要求3所述的拍照方法,其中,所述方法还包括:当与所述人体类型对应的候选关键点集合有多个时,对于每个与所述人体类型对应的候选关键点集合,获取其对应的构图边界框;将多个与所述人体类型对应的候选关键点集合中构图边界框与所述人体边界框匹配的候选关键点集合确定为与所述拍摄场景对应的构图关键点集合。
- 根据权利要求1所述的拍照方法,其中,所述确定与所述拍摄场景对应的构图关键点集合之后,还包括:计算每个人体关键点与对应的构图关键点之间的距离,得到多个距离;计算所述多个距离的平均距离;所述人体关键点集合与所述构图关键点集合不匹配,包括:所述平均距离大于或等于预设平均距离。
- 根据权利要求5所述的拍照方法,其中,所述生成并输出调整电子设备的姿态的提示信息,包括:生成多个候选向量;预测按照每个候选向量调整电子设备的姿态之后所得到的目标人体关键点集合;将多个候选向量中目标人体关键点集合与所述构图关键点集合匹配的候选向量确定为目标向量;根据所述目标向量生成并输出调整电子设备的姿态的提示信息。
- 根据权利要求1所述的拍照方法,其中,所述确定与所述拍摄场景对应的构图关键点集合之后,还包括:从所述人体关键点集合中确定人脸关键点集合;获取每个人脸关键点的横坐标,得到多个第一横坐标;计算所述多个第一横坐标的第一均值;当所述第一均值处于预设均值范围内时,从所述构图关键点集合中确定与所述人脸关键点集合对应的目标构图关键点集合;所述人体关键点集合与所述构图关键点集合不匹配,包括:所述人脸关键点集合与所述目标构图关键点集合不匹配。
- 根据权利要求7所述的拍照方法,其中,所述从所述构图关键点集合中确定与所述人脸关键点集合对应的目标构图关键点集合之后,还包括:获取每个人脸关键点的纵坐标,得到多个第一纵坐标,并获取每个目标构图关键点的横坐标和纵坐标,得到多个第二横坐标和多个第二纵坐标;计算所述多个第一纵坐标的第二均值、所述多个第二横坐标的第三均值,以及所述多个第二纵坐标的第四均值;根据所述第一均值和所述第二均值,确定第一目标坐标,并根据所述第三均值和所述第四均值,确定第二目标坐标;计算所述第一目标坐标与所述第二目标坐标之间的第一距离;所述人脸关键点集合与所述目标构图关键点集合不匹配,包括:所述第一距离大于或等于第一预设距离。
- 根据权利要求7所述的拍照方法,其中,所述计算所述多个第一横坐标的第一均值之后,还包括:当所述第一均值不处于预设均值范围内时,检测所述人体关键点集合中是否存在预设关键点;若所述人体关键点集合中不存在预设关键点,则获取所述人体边界框的第一中心坐标,以及所述构图关键点集合对应的构图边界框的第二中心坐标;计算所述第一中心坐标与所述第二中心坐标之间的第二距离;所述人体关键点集合与所述构图关键点集合不匹配,包括:所述第二距离大于或等于第二预设距离。
- 根据权利要求9所述的拍照方法,其中,所述检测所述人体关键点集合中是否存在预设关键点之后,还包括:若所述人体关键点集合中存在预设关键点,则获取所述人体边界框的第一中心横坐标,以及所述构图关键点集合对应的构图边界框的第二中心横坐标;从所述构图关键点集合中确定与所述人脸关键点集合对应的目标构图关键点集合;获取每个人脸关键点的纵坐标,得到多个第三纵坐标,并获取每个目标构图关键点的纵坐标,得到多个第四纵坐标;计算所述多个第三纵坐标的第五均值,以及所述多个第四纵坐标的第六均值;根据所述第一中心横坐标和所述第五均值,确定第三目标坐标,并根据所述第二中心横坐标和第六均值,确定第四目标坐标;计算所述第三目标坐标与所述第四目标坐标之间的第三距离;所述人体关键点集合与所述构图关键点集合不匹配,包括:所述第三距离大于或等于第三预设距离。
- 一种拍照装置,应用于电子设备,其中,包括:检测模块,用于对拍摄场景中的人体进行关键点检测,得到所述人体的人体关键点集合;确定模块,用于确定与所述拍摄场景对应的构图关键点集合;生成模块,用于当所述人体关键点集合与所述构图关键点集合不匹配时,生成并输出调整电子设备的姿态的提示信息;拍摄模块,用于当所述人体的实时人体关键点集合与所述构图关键点集合匹配时,对拍摄场景进行拍摄,得到目标图像。
- 一种存储介质,其中,所述存储介质中存储有计算机程序,当所述计算机程序在计算机上运行时,使得所述计算机执行权利要求1所述的拍照方法。
- 一种电子设备,其中,所述电子设备包括处理器和存储器,所述存储器中存储有计算机程序,所述处理器通过调用所述存储器中存储的所述计算机程序,用于执行:对拍摄场景中的人体进行关键点检测,得到所述人体的人体关键点集合;确定与所述拍摄场景对应的构图关键点集合;当所述人体关键点集合与所述构图关键点集合不匹配时,生成并输出调整电子设备的姿态的提示信息;当所述人体的实时人体关键点集合与所述构图关键点集合匹配时,对拍摄场景进行拍摄,得到目标图像。
- 根据权利要求13所述的电子设备,其中,所述处理器用于执行:获取拍摄场景的预览图像;利用人像检测模型对所述预览图像进行人像检测,得到人体边界框;基于所述人体边界框从所述预览图像中裁切出人体图像;利用关键点检测模型对所述人体图像进行关键点检测,得到所述人体的人体关键点集合。
- 根据权利要求14所述的电子设备,其中,所述处理器用于执行:将所述预览图像划分为前景图像和背景图像;确定所述背景图像对应的多个候选关键点集合;确定所述人体的人体类型;将所述多个候选关键点集合中与所述人体类型对应的候选关键点集合确定为与所述拍摄场景对应的构图关键点集合。
- 根据权利要求15所述的电子设备,其中,所述处理器用于执行:当与所述人体类型对应的候选关键点集合有多个时,对于每个与所述人体类型对应的候选关键点集合,获取其对应的构图边界框;将多个与所述人体类型对应的候选关键点集合中构图边界框与所述人体边界框匹配的候选关键点集合确定为与所述拍摄场景对应的构图关键点集合。
- 根据权利要求13所述的电子设备,其中,所述处理器用于执行:计算每个人体关键点与对应的构图关键点之间的距离,得到多个距离;计算所述多个距离的平均距离;当所述平均距离大于或等于预设平均距离时,生成并输出调整电子设备的姿态的提示信息。
- 根据权利要求17所述的电子设备,其中,所述处理器用于执行:生成多个候选向量;预测按照每个候选向量调整电子设备的姿态之后所得到的目标人体关键点集合;将多个候选向量中目标人体关键点集合与所述构图关键点集合匹配的候选向量确定为目标向量;根据所述目标向量生成并输出调整电子设备的姿态的提示信息。
- 根据权利要求13所述的电子设备,其中,所述处理器用于执行:从所述人体关键点集合中确定人脸关键点集合;获取每个人脸关键点的横坐标,得到多个第一横坐标;计算所述多个第一横坐标的第一均值;当所述第一均值处于预设均值范围内时,从所述构图关键点集合中确定与所述人脸关键点集合对应的目标构图关键点集合;当所述人脸关键点集合与所述目标构图关键点集合不匹配时,生成并输出调整电子设备的姿态的提示信息。
- 根据权利要求19所述的电子设备,其中,所述处理器用于执行:获取每个人脸关键点的纵坐标,得到多个第一纵坐标,并获取每个目标构图关键点的横坐标和纵坐标,得到多个第二横坐标和多个第二纵坐标;计算所述多个第一纵坐标的第二均值、所述多个第二横坐标的第三均值,以及所述多个第二纵坐标的第四均值;根据所述第一均值和所述第二均值,确定第一目标坐标,并根据所述第三均值和所述第四均值,确 定第二目标坐标;计算所述第一目标坐标与所述第二目标坐标之间的第一距离;当所述第一距离大于或等于第一预设距离时,生成并输出调整电子设备的姿态的提示信息。
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
EP20914860.0A EP4093015A4 (en) | 2020-01-22 | 2020-12-31 | PHOTOGRAPHY METHOD AND APPARATUS, STORAGE MEDIA AND ELECTRONIC DEVICE |
US17/870,012 US20220360707A1 (en) | 2020-01-22 | 2022-07-21 | Photographing method, photographing device, storage medium and electronic device |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010075364.1 | 2020-01-22 | ||
CN202010075364.1A CN111277751B (zh) | 2020-01-22 | 2020-01-22 | 拍照方法、装置、存储介质及电子设备 |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US17/870,012 Continuation US20220360707A1 (en) | 2020-01-22 | 2022-07-21 | Photographing method, photographing device, storage medium and electronic device |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021147650A1 true WO2021147650A1 (zh) | 2021-07-29 |
Family
ID=71001190
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2020/142422 WO2021147650A1 (zh) | 2020-01-22 | 2020-12-31 | 拍照方法、装置、存储介质及电子设备 |
Country Status (4)
Country | Link |
---|---|
US (1) | US20220360707A1 (zh) |
EP (1) | EP4093015A4 (zh) |
CN (1) | CN111277751B (zh) |
WO (1) | WO2021147650A1 (zh) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115601783A (zh) * | 2022-07-07 | 2023-01-13 | 浙江大华技术股份有限公司(Cn) | 目标检测方法、设备及存储介质 |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111277751B (zh) * | 2020-01-22 | 2021-06-15 | Oppo广东移动通信有限公司 | 拍照方法、装置、存储介质及电子设备 |
CN114845038A (zh) * | 2021-02-02 | 2022-08-02 | 阿里巴巴集团控股有限公司 | 视频拍摄设备的拍摄调整方法、装置及电子设备 |
CN113515143B (zh) * | 2021-06-30 | 2024-06-21 | 深圳市优必选科技股份有限公司 | 机器人导航方法、机器人及计算机可读存储介质 |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130155293A1 (en) * | 2011-12-16 | 2013-06-20 | Samsung Electronics Co., Ltd. | Image pickup apparatus, method of providing composition of image pickup and computer-readable recording medium |
JP2014236334A (ja) * | 2013-05-31 | 2014-12-15 | 株式会社ニコン | 撮像装置 |
CN105100625A (zh) * | 2015-08-27 | 2015-11-25 | 华南理工大学 | 一种基于图像美学的人物图像辅助拍摄方法和系统 |
CN107426489A (zh) * | 2017-05-05 | 2017-12-01 | 北京小米移动软件有限公司 | 拍摄图像时的处理方法、装置及终端 |
CN108289174A (zh) * | 2018-01-25 | 2018-07-17 | 努比亚技术有限公司 | 一种拍摄方法、移动终端及计算机可读存储介质 |
CN109472198A (zh) * | 2018-09-28 | 2019-03-15 | 武汉工程大学 | 一种姿态鲁棒的视频笑脸识别方法 |
CN109660719A (zh) * | 2018-12-11 | 2019-04-19 | 维沃移动通信有限公司 | 一种信息提示方法及移动终端 |
CN111277751A (zh) * | 2020-01-22 | 2020-06-12 | Oppo广东移动通信有限公司 | 拍照方法、装置、存储介质及电子设备 |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007274017A (ja) * | 2006-03-30 | 2007-10-18 | Fujifilm Corp | 自動トリミング方法および装置ならびにプログラム |
CN108399362B (zh) * | 2018-01-24 | 2022-01-07 | 中山大学 | 一种快速行人检测方法及装置 |
-
2020
- 2020-01-22 CN CN202010075364.1A patent/CN111277751B/zh active Active
- 2020-12-31 EP EP20914860.0A patent/EP4093015A4/en not_active Withdrawn
- 2020-12-31 WO PCT/CN2020/142422 patent/WO2021147650A1/zh unknown
-
2022
- 2022-07-21 US US17/870,012 patent/US20220360707A1/en not_active Abandoned
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130155293A1 (en) * | 2011-12-16 | 2013-06-20 | Samsung Electronics Co., Ltd. | Image pickup apparatus, method of providing composition of image pickup and computer-readable recording medium |
JP2014236334A (ja) * | 2013-05-31 | 2014-12-15 | 株式会社ニコン | 撮像装置 |
CN105100625A (zh) * | 2015-08-27 | 2015-11-25 | 华南理工大学 | 一种基于图像美学的人物图像辅助拍摄方法和系统 |
CN107426489A (zh) * | 2017-05-05 | 2017-12-01 | 北京小米移动软件有限公司 | 拍摄图像时的处理方法、装置及终端 |
CN108289174A (zh) * | 2018-01-25 | 2018-07-17 | 努比亚技术有限公司 | 一种拍摄方法、移动终端及计算机可读存储介质 |
CN109472198A (zh) * | 2018-09-28 | 2019-03-15 | 武汉工程大学 | 一种姿态鲁棒的视频笑脸识别方法 |
CN109660719A (zh) * | 2018-12-11 | 2019-04-19 | 维沃移动通信有限公司 | 一种信息提示方法及移动终端 |
CN111277751A (zh) * | 2020-01-22 | 2020-06-12 | Oppo广东移动通信有限公司 | 拍照方法、装置、存储介质及电子设备 |
Non-Patent Citations (1)
Title |
---|
See also references of EP4093015A4 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115601783A (zh) * | 2022-07-07 | 2023-01-13 | 浙江大华技术股份有限公司(Cn) | 目标检测方法、设备及存储介质 |
Also Published As
Publication number | Publication date |
---|---|
EP4093015A4 (en) | 2023-06-21 |
US20220360707A1 (en) | 2022-11-10 |
CN111277751B (zh) | 2021-06-15 |
EP4093015A1 (en) | 2022-11-23 |
CN111277751A (zh) | 2020-06-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021147650A1 (zh) | 拍照方法、装置、存储介质及电子设备 | |
WO2021047345A1 (zh) | 图像降噪方法、装置、存储介质及电子设备 | |
CN111327824B (zh) | 拍摄参数的选择方法、装置、存储介质及电子设备 | |
CN113313661B (zh) | 图像融合方法、装置、电子设备及计算机可读存储介质 | |
CN111028190A (zh) | 图像处理方法、装置、存储介质及电子设备 | |
WO2019105297A1 (zh) | 图像虚化处理方法、装置、移动设备及存储介质 | |
CN104125405B (zh) | 基于眼球追踪和自动对焦系统的图像感兴趣区域提取方法 | |
US11825183B2 (en) | Photographing method and photographing apparatus for adjusting a field of view of a terminal | |
TWI640199B (zh) | 影像擷取裝置及其攝影構圖的方法 | |
WO2019105298A1 (zh) | 图像虚化处理方法、装置、移动设备及存储介质 | |
US20220329729A1 (en) | Photographing method, storage medium and electronic device | |
WO2022001806A1 (zh) | 图像变换方法和装置 | |
JP2019106045A (ja) | 画像処理装置、方法及びプログラム | |
CN110266954A (zh) | 图像处理方法、装置、存储介质及电子设备 | |
WO2020042188A1 (zh) | 一种图像拍摄方法和装置 | |
CN107547789B (zh) | 影像获取装置及其摄影构图的方法 | |
CN113850709A (zh) | 图像变换方法和装置 | |
CN108462831B (zh) | 图像处理方法、装置、存储介质及电子设备 | |
WO2021147648A1 (zh) | 提示方法、装置、存储介质及电子设备 | |
WO2021179819A1 (zh) | 照片处理方法、装置、存储介质及电子设备 | |
CN108520036B (zh) | 图像的选取方法、装置、存储介质及电子设备 | |
WO2022183876A1 (zh) | 拍摄方法、装置、计算机可读存储介质及电子设备 | |
CN113037990B (zh) | 辅助拍摄方法、终端设备及计算机可读存储介质 | |
CN114841863A (zh) | 一种图像颜色校正方法和设备 | |
JP2020191546A (ja) | 画像処理装置、画像処理方法、およびプログラム |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 20914860 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
ENP | Entry into the national phase |
Ref document number: 2020914860 Country of ref document: EP Effective date: 20220817 |