Image capture method and electronic device
By evaluating and saving the image frames with the highest composition quality, the problem of character distribution and the positional relationship of multiple characters not being considered in the existing technology is solved, and a high-quality image composition effect is achieved.
Patent Information
- Application Number
- CN202310206533.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-23
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2043-02-23
AI Technical Summary
The existing technology fails to effectively consider the distribution of characters in the picture and the positional relationship between multiple characters when taking pictures, resulting in possible imbalance of the image and failure to provide high-quality composition suggestions.
By displaying multiple frames of images in real time, the composition indicators of each frame of image are evaluated, including distance parameters, closeness parameters and compactness parameters, and the frame or frames of images with the highest composition quality are saved to ensure the composition quality of the image.
It avoids rigid photo templates, gives users more room to play, and assists users in obtaining high-quality images, avoiding image imbalance and unreasonable composition problems.
Smart Images

Figure CN117135441B
Abstract
Description
Technical Field
[0001] The present application relates to the field of image technology, and in particular to an image capture method and electronic equipment. Background Art
[0002] With the rapid development of electronic technology, the camera pixels on electronic devices such as mobile phones and tablets are getting higher and higher, which makes more and more users use mobile phones, tablets and other electronic devices to take pictures. In order to meet the photography needs of users, major equipment manufacturers continue to upgrade the hardware of electronic devices to improve the image quality and clarity of the captured images. However, users' demand for photography is not limited to image quality and clarity, but also includes requirements for the aesthetics of the picture, such as picture composition.
[0003] Considering that most users do not have professional photography skills and may not be able to compose the picture properly, related technologies can use basic composition schemes to guide users to shoot. For example, the face or body of the person in the picture can be detected to obtain the face position or body position; when the face position or body position meets the pre-defined photo template, the photo operation is triggered. However, this method does not take into account the distribution of the person's weight in the picture; at the same time, when there are multiple people in the picture, it does not take into account the positional relationship between the multiple people, which can easily lead to an unbalanced picture. Summary of the invention
[0004] The embodiments of the present application provide an image capture method and an electronic device for screening multiple frames of images to obtain images with higher composition quality.
[0005] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:
[0006] In a first aspect, the present application provides an image capture method, which is applied to an electronic device, the electronic device including a camera, and the method including: displaying multiple frames of images captured by the camera in real time; determining the composition index of the corresponding image based on the character information of each frame of the image; wherein the character information includes the number of target persons and one or more of multiple character parameters, the multiple character parameters include the center of mass position of the target person, the area ratio of the target person and the face position of the target person, the composition index includes one or more of the multiple composition parameters, the multiple composition parameters include a distance parameter, an intimacy parameter and a compactness parameter, the distance parameter is used to indicate the degree of match between the image and a preset composition rule, the intimacy parameter is used to indicate the intimacy between at least two target persons in the image, and the compactness parameter is used to indicate the discrete degree of position arrangement between at least three target persons in the image; saving one or more frames of images with the highest composition quality in the multiple frames of images; wherein, the smaller the distance parameter, the smaller the intimacy parameter or the smaller the compactness parameter, the higher the composition quality of the image.
[0007] It can be understood that the present application evaluates the composition quality of the image through three quantitative parameters (i.e., distance parameter, intimacy parameter, and compactness parameter) by quantifying the degree of match between the image and the preset composition rules, the intimacy between at least two target persons in the image, and the discreteness of the position arrangement between at least three target persons in the image, and saves one or more frames with the highest composition quality. This can not only avoid the rigidity of the photo template and give users room to play freely, but also help users obtain high-quality images.
[0008] In one embodiment provided in the first aspect, the composition index includes a distance parameter, and when the number of people N ≥ 2, the character information includes the center of mass position of N target characters and the area ratio of the N target characters; the composition index of the corresponding image is determined according to the character information of each frame of the image, including: for each of the N target characters, according to the distance from the center of mass position of the target character to the preset reference position, the corresponding basic distance parameter is obtained; the distance parameter is obtained by weighted averaging the basic distance parameters corresponding to all target characters with the area ratio of each target character as a weight. It can be understood that when there are multiple target characters, weighted averaging is performed by using the area ratio of different target characters as a weight, which can effectively evaluate whether the multiple target characters are close to the reference position. The closer the target character is to the reference position, the higher the composition quality of the image.
[0009] In an implementation provided by the first aspect, when the number of people N=1, the character information includes the center of mass position of each target character, and the composition index of the corresponding image is determined according to the character information of each frame image, including: obtaining the corresponding basic distance parameter according to the distance from the center of mass position of the target character to a preset reference position; and determining the basic distance parameter as the distance parameter.
[0010] In an embodiment provided in the first aspect, the preset reference position includes multiple reference positions; according to the distance from the center of mass position of the target person to the preset reference position, a corresponding basic distance parameter is obtained, including: taking the minimum value of the distance from the center of mass position of the target person to the multiple reference positions as the corresponding basic distance parameter; or, the preset reference position includes one reference position; according to the distance from the center of mass position of the target person to the preset reference position, a corresponding basic distance parameter is obtained, including: taking the distance from the center of mass position of the target person to a reference position as the corresponding basic distance parameter.
[0011] In an implementation manner provided in the first aspect, the preset reference position includes: four interest points of the image, two diagonal lines of the image, four trisection lines of the image, or the center point of the image. Specifically, the preset reference positions of the first composition rule (golden composition rule) are the four interest points of the image, the preset reference positions of the second composition rule (rule of thirds composition) are the four trisection lines of the image, the preset reference positions of the third composition rule (diagonal line rule) are the two diagonal lines of the image, and the preset reference positions of the fourth composition rule (central composition rule) are the center point of the image.
[0012] In an implementation provided by the first aspect, when the number of people N≥2, the composition index includes an intimacy parameter, the character information includes the face positions of N target characters, and the composition index of the corresponding image is determined according to the character information of each frame of the image, including: constructing a second-order tree structure with N face positions as nodes and the line connecting any two face positions as edges; wherein the weight of each edge is the distance between the two face positions corresponding to the edge; constructing a minimum spanning tree of the second-order tree structure, the minimum spanning tree includes N-1 edges; and determining the average value of the weights of the N-1 edges as the intimacy parameter.
[0013] In an implementation provided by the first aspect, when the number of people N ≥ 3, the composition index also includes a compactness parameter, the character information also includes the center of mass positions of N target characters, and the composition index of the corresponding image is determined based on the character information of each frame of the image, and also includes: respectively determining the standard deviation of the N center of mass positions in the first direction and the standard deviation in the second direction; and determining the smaller value of the standard deviation in the first direction and the standard deviation in the second direction as the compactness parameter.
[0014] In an embodiment provided in the first aspect, the method also includes: comparing composition indicators of any two frames of images in the multiple frames, and eliminating the frame with low composition quality in the any two frames of images; continuing to compare the composition indicators of any two frames of images in the multiple frames after eliminating the frame with low composition quality, until all the multiple frames of images are compared.
[0015] In an implementation manner provided in the first aspect, when the number of people in any two frames of images is 1, the composition index includes a distance parameter, the distance parameter includes a first distance parameter, a second distance parameter, a third distance parameter and a fourth distance parameter, the first distance parameter is used to reflect the degree of matching between the image and the first composition rule, the second distance parameter is used to reflect the degree of matching between the image and the second composition rule, the third distance parameter is used to reflect the degree of matching between the image and the third composition rule, and the fourth distance parameter is used to reflect the degree of matching between the image and the fourth composition rule, and the first composition rule, the second composition rule, the third composition rule and the fourth composition rule include different reference positions; comparing the composition index of any two frames of images in the plurality of frames of images includes: when the difference between the first distance parameters of any two frames of images is greater than or equal to a first threshold, comparing the first distance parameters of any two frames of images, wherein the image with a smaller first distance parameter has a higher composition quality; when the difference between the first distance parameters of any two frames of images is less than the first threshold, judging whether the composition index of any two frames of images is greater than or equal to a first threshold. whether the difference of the second distance parameters of any two frames of images is greater than or equal to the second threshold; when the difference of the second distance parameters of any two frames of images is greater than or equal to the second threshold, compare the second distance parameters of any two frames of images, wherein the image with the smaller second distance parameter has higher composition quality; when the difference of the second distance parameters of any two frames of images is less than the second threshold, judge whether the difference of the third distance parameters of any two frames of images is greater than or equal to the third threshold; when the difference of the third distance parameters of any two frames of images is greater than or equal to the third threshold, compare the third distance parameters of any two frames of images, wherein the image with the smaller third distance parameter has higher composition quality; when the difference of the third distance parameters of any two frames of images is less than the third threshold, judge whether the difference of the fourth distance parameters of any two frames of images is greater than or equal to the fourth threshold; when the difference of the fourth distance parameters of any two frames of images is greater than or equal to the fourth threshold, compare the fourth distance parameters of any two frames of images, wherein the image with the smaller fourth distance parameter has higher composition quality.
[0016] In an embodiment provided by the first aspect, if the number of people in one frame of any two frames of images is N=2, and the number of people in the other frame of images is N≥2, the composition index also includes an intimacy parameter, and comparing the composition indicators of any two frames of images in multiple frames of images also includes: when the difference between the fourth distance parameters of any two frames of images is less than the fourth threshold, judging whether the difference between the intimacy parameters of any two frames of images is greater than or equal to the fifth threshold; when the difference between the intimacy parameters of any two frames of images is greater than or equal to the fifth threshold, comparing the intimacy parameters of any two frames of images, wherein the image with a smaller intimacy parameter has a higher composition quality.
[0017] In an embodiment provided by the first aspect, if the number of people in any two frames of images is greater than or equal to 2, the composition index also includes a compactness parameter, and comparing the composition index of any two frames of images in a plurality of frames of images includes: when the difference in the compactness parameters of any two frames of images is greater than or equal to a sixth threshold, comparing the compactness parameters of any two frames of images, wherein the image with a smaller compactness parameter has a higher composition quality.
[0018] In an implementation manner provided in the first aspect, the target person is each person in the image, or the target person is a person in the image whose area ratio is greater than a preset threshold and whose center of mass position is within a preset area.
[0019] In an embodiment provided in the first aspect, the method also includes: performing human body detection, face detection and key point detection on multiple frames of images to obtain human body detection results, face detection results and key point detection results respectively; determining the shooting state of each character in the multiple frames of images according to the human body detection results, face detection results and key point detection results; wherein the shooting state includes the motion state of the character and one or more of the following multiple states, and the multiple states include: the center of mass position of the character, the portrait type and the area ratio of the character; saving one or more frames of images with the highest composition quality in the multiple frames of images, including: saving one or more frames of legal images with the highest composition quality in the multiple frames of images; wherein the legal image is an image in which the shooting states of all characters are valid.
[0020] In an implementation provided in the first aspect, if the key point detection results only include the top of the head key point and the neck key point, the portrait type is a close-up of the face, and the center of mass position of the person is the average coordinate point of the top of the head key point and the neck key point.
[0021] In an embodiment provided in the first aspect, if the key point detection results only include the top of the head key point, the neck key point, the shoulder key point and one or more of the following multiple first key points, the portrait type is a bust portrait, and the center of mass position of the character is the average coordinate point of the neck key point and the shoulder key point, and the multiple first key points include the arm key point and the wrist key point.
[0022] In an embodiment provided in the first aspect, if the key point detection results only include the top of the head key point, the neck key point, the shoulder key point, the hip joint key point, the arm key point and one or more of the following multiple second key points, then the portrait type is a seven / ninth-point portrait, and the center of mass position of the character is the average coordinate point of the top of the head key point, the neck key point, the shoulder key point, the hip joint key point, and the arm key point, and the multiple second key points include the wrist key point and the knee key point.
[0023] In an embodiment provided in the first aspect, if the key point detection results only include the top of the head key point, the ankle key point and one or more of the following multiple third key points, the portrait type is a full-body portrait, and the center of mass position of the character is the center point position of the character's body frame, and the multiple third key points include shoulder key points, hip joint key points, arm key points, wrist key points, and knee key points.
[0024] In an implementation provided by the first aspect, if the key point detection result does not include the top of the head key point and the neck key point, the portrait type is a partial close-up, and the center of mass position of the person is the average coordinate point of all key points detected.
[0025] In an implementation manner provided in the first aspect, the human body detection result includes a human body frame of the person, and the area ratio of the person is the ratio of the area of the human body frame to the image area.
[0026] In an implementation manner provided in the first aspect, the face detection result includes a face frame, and the face position is the center point position of the face frame, or the center of mass position of the person's head.
[0027] In an implementation provided in the first aspect, if the person is in motion, and the portrait type of the person is not a full-length portrait or a half-length portrait and does not include at least one of the key points of the top of the head, the key points of the neck, the key points of the ankles, and the key points of the wrists, the shooting status of the person is invalid.
[0028] In an implementation provided by the first aspect, if the person is in a stationary state, and the person does not open his eyes, does not smile, the portrait type is a bust portrait and the area ratio is greater than the seventh threshold or does not include the top of the head key points and the neck key points, the shooting status of the person is invalid.
[0029] In a second aspect, the present application provides an electronic device, comprising: a memory and a processor; the processor is coupled to the memory; wherein the memory is used to store computer program code, and the computer program code comprises computer instructions; when the computer instructions are executed by the processor, the electronic device executes a method as in any one of the embodiments of the first aspect.
[0030] In a third aspect, the present application provides a computer-readable storage medium, comprising computer instructions; when the computer instructions are executed on an electronic device, the electronic device executes a method as in any one of the embodiments of the first aspect.
[0031] In a fourth aspect, the present application provides a computer program product, which, when executed on a terminal device, enables the terminal device to execute the method of the first aspect and any possible design thereof.
[0032] In a fifth aspect, the present application provides a chip system, which includes one or more interface circuits and one or more processors. The interface circuit and the processor are interconnected by lines. The above chip system can be applied to a terminal device including a communication module and a memory. The interface circuit is used to receive a signal from the memory of the terminal device and send the received signal to the processor, where the signal includes a computer instruction stored in the memory. When the processor executes the computer instruction, the terminal device can execute the method of the first aspect and any possible design thereof.
[0033] Among them, the technical effects brought about by any design method in the second to fifth aspects can refer to the technical effects brought about by different design methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 A schematic diagram of an interface provided in an embodiment of the present application;
[0035] Figure 2 Another interface schematic diagram provided for an embodiment of the present application;
[0036] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0037] Figure 4 A set of interface schematic diagrams provided for embodiments of the present application;
[0038] Figure 5 A set of interface schematic diagrams provided for embodiments of the present application;
[0039] Figure 6 A set of interface schematic diagrams provided for embodiments of the present application;
[0040] Fig. 7A A schematic diagram of a method for capturing an image provided in an embodiment of the present application Figure 1 ;
[0041] Figure 7B Another interface schematic diagram provided for an embodiment of the present application;
[0042] Figure 8 A schematic diagram of a method for capturing an image provided in an embodiment of the present application Figure 2 ;
[0043] Fig. 9 A schematic diagram of a portrait provided in an embodiment of the present application;
[0044] Fig.10 Another schematic diagram of a portrait provided in an embodiment of the present application;
[0045] Fig.11Another schematic diagram of a portrait provided in an embodiment of the present application;
[0046] Fig.12 A schematic diagram of another portrait provided in an embodiment of the present application;
[0047] Fig.13A A schematic diagram of a method for capturing an image provided in an embodiment of the present application Figure 3 ;
[0048] Fig. 13B The reference positions of the golden triangle composition rule, the rule of thirds composition rule, the diagonal rule and the central composition rule are shown;
[0049] Fig.14 A schematic diagram of a method for capturing an image provided in an embodiment of the present application Figure 4 ;
[0050] Fig.15 A schematic diagram of generating a second-order tree structure provided in an embodiment of the present application;
[0051] Fig.16 A schematic diagram of a minimum spanning tree provided in an embodiment of the present application;
[0052] Fig.17 A schematic diagram of another method for generating a second-order tree structure provided in an embodiment of the present application;
[0053] Fig.18 A schematic diagram of a method for capturing an image provided in an embodiment of the present application Figure 5 ;
[0054] Fig.19 A schematic diagram of a method for capturing an image provided in an embodiment of the present application Figure 6 ;
[0055] Fig. 20 A schematic diagram of the structure of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] The technical solutions in the embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and the appended claims of the present application, the singular expressions "a", "said", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear indication to the contrary in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one or more (including two). The term "and / or" is used to describe the association relationship of associated objects, indicating that three relationships can exist; for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in a "or" relationship.
[0057] References to "one embodiment" or "some embodiments" etc. described in this specification mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Thus, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways. The term "connection" includes direct connection and indirect connection, unless otherwise specified. "First" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated.
[0058] In the embodiments of the present application, the words "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.
[0059] In order to enable users to obtain high-quality images, the related art provides a solution that uses a basic composition solution to guide users to take pictures. Specifically, the electronic device can detect the face or body of the person in the picture, obtain the face position or body position, and trigger the photo operation when the face position or body position meets the pre-defined photo template. However, this solution includes at least the following two problems:
[0060] First, the distribution of the person's weight in the picture is not taken into account, resulting in an imbalance in the image. Figure 1 As shown, the electronic device detects the person in the picture and performs a shooting operation when it determines that the position of the person meets the predefined shooting template. However, since the distribution of the person's weight in the picture is not considered, the picture does not include the person's head, that is, the picture is unbalanced and the image quality is not high.
[0061] Second, the positional relationship between multiple people in a multi-person shooting scene is not taken into account, which may result in unreasonable positions of some people in the captured image. Figure 2 As shown, the electronic device performs face detection on two persons (person a and person b) in the picture, and performs a photo shooting operation when one of the persons (for example, person a) is detected to meet the predefined photo template. However, since the positional relationship between person b and person a is not taken into account, only half of person b's face is included in the picture, and the image quality is not high.
[0062] The embodiment of the present application provides an image capture method, which can determine the shooting status of each character in the multiple frames of images after acquiring multiple frames of images, and finally retain the legal images in the multiple frames of images. The legal images are images in which the shooting status of all characters is valid.
[0063] Among them, the shooting status refers to the status of the character in the picture, including but not limited to the character's state of motion, the character's portrait type, the key points of the character, the character's area ratio in the picture, the character's position in the picture, and whether the character has his eyes open or is smiling.
[0064] For example, the motion state of the character includes but is not limited to walking, running, jumping, playing badminton, swimming, standing still, etc. The types of character portraits include facial close-up, bust, 70% / 90% portrait, full-body portrait, and partial close-up, etc., which are used to roughly represent the approximate truncation state of the character's body parts in the picture.
[0065] The electronic device can pre-set multiple invalid states. If the shooting state of the person is not any of the multiple invalid states, the shooting state of the person can be considered reasonable. For example, multiple invalid states include: the person is running or playing badminton, but part of the person's limbs (such as head, hands, feet) are missing (i.e., not appearing in the picture); the person is in a static state, but the person does not open his eyes and / or smile; the person in the picture is in a static state, but the person is located in the corner of the picture (such as four sides, four corners, etc.), etc.
[0066] It can be seen that by determining the shooting status of each character, it is possible to avoid retaining images with unbalanced pictures and images that are obviously not aesthetically pleasing (such as missing arms and legs), thereby achieving the effect of ensuring image quality.
[0067] Furthermore, the electronic device may also evaluate the composition quality of multiple frames of images, and retain one or more frames of images with higher composition quality among the multiple frames of images.
[0068] In this embodiment, the composition quality of an image can be evaluated from at least three aspects: basic composition, social relationships in a multi-person scene, and character position arrangement in a multi-person scene. Among them, the basic composition can be used to reflect whether the position of the character matches the common photography composition rules. If the position of the character matches the common photography composition method, it can be considered that the basic composition of the image conforms to conventional aesthetics and has a high composition quality.
[0069] Social relationships in multi-person scenes can be used to measure whether the relationship between multiple characters is close when there are multiple characters in the image. If the relationship between multiple characters is close, it can be considered that the image may have more abundant emotions, can affect the viewer emotionally, and has a higher composition quality.
[0070] The position arrangement of characters in a multi-person scene can be used to measure whether the arrangement of multiple characters is dispersed when there are three or more characters in the image. If the arrangement of multiple characters is not dispersed, it can be considered that the position arrangement of multiple characters in the image is reasonable and the composition quality is high.
[0071] Among them, compared with the method of simply matching the photo template by identifying the human body position / face position, the present application does not need to set the photo template in advance. Instead, after capturing multiple frames of images, the image composition quality is evaluated from multiple dimensions, and the images with good basic composition, close relationships between characters, and reasonable personnel arrangement are retained. The images obtained in this way can avoid the rigidity of the photo template, give users room for free play, and help users obtain high-quality images.
[0072] It should be noted that the image capture method provided in the embodiment of the present application can be applied to a scenario in which a camera application is used in an electronic device, and in this scenario, image frames with high composition quality can be captured.
[0073] Exemplarily, by using the image capture method provided in the embodiment of the present application, multiple frames of images can be actively acquired during the image preview process before the electronic device takes photos / records, and one or more frames of images with high composition quality can be saved.
[0074] Also exemplarily, by using the image capture method provided in the embodiment of the present application, one or more frames of images with high composition quality can be saved among multiple frames of images included in a video stream during the process of recording a video by an electronic device.
[0075] In the following, the image capture method provided in the embodiment of the present application is mainly explained by taking the image preview process before taking pictures / recording as an example.
[0076] It should be noted that the electronic device provided in the embodiments of the present application may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, and a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, a vehicle-mounted device, a smart home device and / or a smart city device, etc., and the embodiments of the present application do not impose any special restrictions on the specific type of the electronic device.
[0077] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 3 As shown, the electronic device may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
[0078] Among them, the above-mentioned sensor module 180 may include sensors such as pressure sensor, gyroscope sensor, air pressure sensor, magnetic sensor, acceleration sensor, distance sensor, proximity light sensor, fingerprint sensor, temperature sensor, touch sensor, ambient light sensor and bone conduction sensor.
[0079] It is to be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device. In other embodiments, the electronic device may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0080] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0081] The controller can be the nerve center and command center of the electronic device. The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of fetching and executing instructions.
[0082] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0083] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0084] It is understandable that the interface connection relationship between the modules illustrated in this embodiment is only a schematic illustration and does not constitute a structural limitation of the electronic device. In other embodiments, the electronic device may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0085] The charging management module 140 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. While the charging management module 140 charges the battery 142, it can also power the electronic device through the power management module 141.
[0086] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160. In some embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0087] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc. In some embodiments, the antenna 1 of the electronic device is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device can communicate with the network and other devices through wireless communication technology.
[0088] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0089] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to electronic devices. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
[0090] The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 can be set in the same device as at least some modules of the processor 110.
[0091] The wireless communication module 160 can provide wireless communication solutions for electronic devices including WLAN (such as wireless fidelity, Wi-Fi) network, Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), nearfield communication technology (NFC), infrared technology (IR), etc.
[0092] The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 may also receive a signal to be sent from the processor 110, modulate the signal, amplify the signal, and convert it into an electromagnetic wave for radiation via the antenna 2.
[0093] The electronic device implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0094] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel.
[0095] The electronic device can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor. ISP is used to process the data fed back by camera 193. Camera 193 is used to capture static images or videos. In some embodiments, the electronic device may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0096] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos can be stored in the external memory card.
[0097] The internal memory 121 may be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory 121. For example, in an embodiment of the present application, the processor 110 may execute the instructions stored in the internal memory 121, and the internal memory 121 may include a program storage area and a data storage area.
[0098] The program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0099] The electronic device can implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, and an application processor. For example, music playback, recording, etc. The button 190 includes a power button, a volume button, etc. The button 190 can be a mechanical button. It can also be a touch button. The motor 191 can generate a vibration prompt. The motor 191 can be used for incoming call vibration prompts, or for touch vibration feedback. The indicator 192 can be an indicator light, which can be used to indicate the charging status, power changes, messages, missed calls, notifications, etc. The SIM card interface 195 is used to connect the SIM card. The SIM card can be inserted into the SIM card interface 195, or pulled out from the SIM card interface 195 to achieve contact and separation with the electronic device. The electronic device can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc.
[0100] The image capture method provided by the present application will be described in detail below with reference to the accompanying drawings.
[0101] After the electronic device opens the camera application, the electronic device can actively capture multiple frames of images and retain one or more frames of images with higher quality.
[0102] In an optional implementation, the camera application has an automatic capture function (also referred to as wonderful capture, smart capture, etc.). The automatic capture function means that when the electronic device intelligently recognizes a specific picture, such as a person smiling, jumping, running, or a pet, it can actively capture the wonderful picture and retain the legal images with high composition quality. In other words, when the automatic capture function is turned on, the electronic device can actively capture multiple frames of images and retain the legal images with high composition quality among the multiple frames.
[0103] For example, the electronic device may be a mobile phone, and the process of enabling the automatic snapshot function may be as follows: Figure 4-Figure 5 shown.
[0104] like Figure 4 As shown in (a) of FIG. 1 , the mobile phone may display an interface 401 (also referred to as a main interface, desktop, Home interface, etc.). The interface 401 includes icons of multiple applications, such as an icon 401a of a camera application and an icon of a settings application. If a user wishes to open the camera application, the user may click the icon 401a of the camera application. The mobile phone may receive an operation of the user clicking the icon 401a of the camera application, and in response to the operation, the mobile phone opens the camera application and displays the following information: Figure 4 The interface 402 shown in (b) in FIG. 4 is a shooting preview interface for displaying the image collected by the camera in real time. Figure 4As shown in (b) of FIG. 4 , the interface 402 includes a setting button 402a, a photo taking button, etc. The mobile phone can receive an operation of a user clicking the setting button 402a, and in response to the operation, the mobile phone can display the following Figure 5 The interface 403 shown in (a) of FIG. The interface 403 includes multiple setting options, such as photo ratio, smart photo 403a, filter recommendation, etc. In response to the user's operation on the smart photo 403a, as shown in FIG. Figure 5 As shown in (b) in the figure, the mobile phone can display interface 404. The interface 404 includes options such as voice-controlled photo taking, gesture photo taking, smile capture, and automatic capture 404a. In addition, the option of automatic capture 404a includes a switch button 404b and a prompt message 404c. The user can turn on or off the automatic capture function by clicking the switch button 404b. The prompt message 404c is used to specifically describe the automatic capture function, for example, "When automatic capture is turned on, it automatically takes photos when intelligently identifying wonderful moments such as people smiling, jumping, running, and cats and dogs."
[0105] In an optional implementation, the electronic device may also store legal images with high composition quality into a gallery, so that the user can view the captured images from the gallery.
[0106] For example, Figure 6 As shown in (a) of FIG. 1 , an electronic device (such as a mobile phone) can display an interface 601, which is a shooting preview interface for displaying images captured by the camera in real time. The interface 601 also includes a thumbnail 601a and an icon 601b. The thumbnail 601a is a thumbnail of the latest frame of the image stored in the mobile phone. The icon 601b is used to indicate that the automatic capture function has been turned on. The mobile phone can receive a user's operation on the icon 601b, and in response to the operation, the mobile phone can display Figure 5 The interface 404 shown in (b) in FIG. 1 is used to set the automatic snapshot function. Figure 6 As shown in (b) of FIG. 6 , if the mobile phone captures a legal image with high composition quality during the period when the mobile phone displays the interface 601, the image can be stored in the gallery and a thumbnail 601c can be displayed. The thumbnail 601c is a thumbnail of the image just captured by the mobile phone and stored in the gallery. If the user wants to view the image just saved by the electronic device, the user can click on the thumbnail 601c. The mobile phone can receive the user's operation on the thumbnail 601c, and in response to the operation, the mobile phone can display the image corresponding to the thumbnail 601c.
[0107] In this embodiment, the electronic device can evaluate the image quality from at least two aspects: one is the shooting status of all characters in the image, and the other is the composition quality of the image, and retain one or more frames of images in which the shooting status of all characters in the multiple frames is valid (i.e., legal) and the composition quality is high.
[0108] In order to more clearly explain the process of evaluating the image quality by the electronic device, the following first describes the process of the electronic device determining the shooting status of all characters in the image and the process of the electronic device determining the composition quality of the image in conjunction with the accompanying drawings. It should be noted that the image can be any frame of the preview stream image data obtained by the camera in real time, and no specific limitation is made here.
[0109] As explained above, the shooting state refers to the state of the person in the picture, including but not limited to the motion state of the person, the truncation state of the person in the picture, the center of mass position of the person, the area ratio of the person in the picture, and whether the person has his eyes open or is smiling, etc. The following first specifically describes the process of the electronic device determining the truncation state of the person in the picture.
[0110] Fig. 7A The following is a schematic diagram showing a process of an image capture method provided in an embodiment of the present application. Figure 1 The process of determining the truncation status of the image character in the picture by the electronic device is specifically described. Fig. 7A As shown, the image capture method includes:
[0111] S710, acquiring an image.
[0112] It should be noted that the camera can obtain preview stream image data in real time, and the preview stream image data includes multiple frames of images. The image in S710 can be any one frame of the multiple frames of images.
[0113] S720, performing human body detection, face detection and key point detection on the image to obtain human body detection results, face detection results and key point detection results.
[0114] Exemplarily, the electronic device may input the image into a human body detection model, a face detection model, and a key point detection model, respectively, to obtain a human body detection result, a face detection result, and a key point detection result.
[0115] It should be noted that the human body detection model, face detection model and key point detection model are all models trained to convergence. Among them, the human body detection model is used to identify the human body in the image and determine the position of the human body frame. The face detection model is used to identify the face in the image, and further identify whether the face is open-eyed, smiling, etc. The face detection results may include the position of the face frame, whether the face is open-eyed, and whether the face is smiling, etc. The key point detection model can be used to identify the key points of the human body of each character in the image, and the key points of the human body include but are not limited to the top of the head, neck, left shoulder, right shoulder, left hip, right hip, left knee, right knee, left ankle, right ankle, left elbow (also called left arm), right elbow (also called right arm), left wrist, right wrist, etc.
[0116] S730, determining the total number of people in the image according to the human body detection result and the face detection result.
[0117] In an optional implementation, the electronic device may perform a matching operation on all face frames and all human body frames. The purpose of matching the human body frame and the face frame is to determine whether the face frame and the human body frame belong to the same person. It can be understood that if the face frame and the human body frame match, it can be determined that the face frame and the human body frame belong to the same person; if the face frame and the human body frame do not match, it can be determined that the face frame and the human body frame do not belong to the same person.
[0118] For example, the electronic device may extract the feature points of each human body frame and the feature points of the face frame, and perform similarity matching based on the feature points to determine the matching face frame and human body frame. For another example, the electronic device may input the face frame and the human body frame into a matching model to obtain the confidence level of the matching between the human body frame and the face frame. When the confidence level of the matching between the human body frame and the face frame is higher than a preset threshold, the human body frame matches the face frame.
[0119] Among them, the number of people N in the image is the sum of the number of human body frames with matching face frames (or the number of face frames with matching human body frames), the number of face frames without matching human body frames, and the number of human body frames without matching face frames.
[0120] For example, Figure 7B An image is shown. The image includes face frame a, face frame b, human body frame c, human body frame d, and human body frame e, wherein face frame a matches human body frame c, face frame b matches human body frame d, and human body frame e does not have a matching face frame. Thus, the number of human body frames with matching face frames in the image is 2, the number of face frames without matching human body frames is 0, and the number of human body frames without matching face frames is 1, so it can be determined that the image includes 3 people, that is, the total number of people is 3.
[0121] S740, determining whether the number of characters currently processed is less than the total number of characters.
[0122] If the number of characters currently processed is less than or equal to the total number of people, execute S750; if the number of characters currently processed is greater than the total number of people, end the process.
[0123] S750: Determine the portrait type and centroid position according to the key point detection result.
[0124] It is understandable that the electronic device can determine the type of the portrait and the position of the person in the picture according to the key point detection result. In this embodiment, considering that the person has a certain outline, the position of the person in the picture is characterized by the center of mass position of the person. That is, the electronic device can determine the type of the portrait and the center of mass position of the person according to the key point detection result.
[0125] Figure 8 The flowchart of the electronic device determining the portrait type and the centroid position of the person according to the key point detection result is shown. It should be noted that the coordinates appearing below are all coordinates in a coordinate system established with the upper left vertex of the image as the origin, the width of the image as the horizontal axis, and the height of the image as the vertical axis.
[0126] like Figure 8 As shown in FIG. 1 , when the key point detection result includes only the key points of the top of the head and the neck, the electronic device can determine that the portrait type is a close-up of the face, and determine the centroid position of the person as the average coordinate point of the key point of the top of the head and the key point of the neck. For example, Fig. 9 As shown, the electronic device can detect the key points of the image to obtain the top of the head key point A and the neck key point B, where the coordinates of the top of the head key point A are (x1, y1), and the coordinates of the neck key point B are (x2, y2). The electronic device can then determine that the portrait type of the image is a facial close-up, and the center of mass position of the character is the average coordinate point R1 of the top of the head key point A and the neck key point B, and the coordinates of the average coordinate point R1 are ((x1+x2) / 2, (y1+y2) / 2).
[0127] In an optional embodiment, when the key point detection results only include key points of the top of the head, neck and shoulders (including the left shoulder or the right shoulder), the electronic device can determine that the portrait type is a bust portrait, and determine the center of mass position of the person as the average coordinate point of the neck key point and the shoulder key point.
[0128] Considering that in some bust portraits, the user's arms and wrists may also be in the frame. Therefore, in another optional implementation, when the key point detection result includes the top of the head key point, the neck key point, and the shoulder key point, the key point detection result further includes the arm key point and / or the wrist key point, and the electronic device can also determine that the portrait type is a bust portrait, and determine the centroid position of the person as the average coordinate point of the neck key point and the shoulder key point.
[0129] For example, Fig.10As shown, the electronic device detects key points of the image and obtains the top key point A, the neck key point B, the left shoulder key point C1, the right shoulder key point C2, the left arm key point D1, the right arm key point D2 and the right wrist key point E1, wherein the coordinates of the top key point A are (x1, y1), the coordinates of the neck key point B are (x2, y2), the coordinates of the left shoulder key point C1 are (x3, y3), and the coordinates of the right shoulder key point C2 are (x4, y4). Then the electronic device can determine that the portrait type of the image is a bust, and the center of mass position of the person is the average coordinate point R2 of the top key point A, the neck key point B, the left shoulder key point C1 and the right shoulder key point C2, and the coordinates of the average coordinate point R2 are:
[0130]
[0131] Among them, N is the number of key points, which is 4.
[0132] In an optional implementation, when the key point detection results only include key points of the top of the head, neck, shoulders, hip joints, and arms, the electronic device can determine the portrait type as a seven-point / nine-point portrait, and determine the center of mass of the person as the average coordinate point of the key points of the hip joint, the arm, the shoulder, the neck, and the top of the head. The algorithm for obtaining the average coordinate point is similar to the method for obtaining the average coordinate point R2, except that N = 5, i.e., i∈[1,5], which will not be repeated here.
[0133] Considering that in some 70% / 90% images, the user's wrists and knees may also be in the frame. Therefore, in another optional implementation, when the key point detection results include the top of the head, neck, shoulders, arms, hip joints, and key points of the arms, if the key point detection results also include wrists and / or knees, the electronic device can also determine that the portrait type is a 70% / 90% image, and determine the center of mass position of the person as the average coordinate point of the top of the head key point, the neck key point, the shoulder key point, the hip joint key point, and the arm key point.
[0134] For example, Fig.11 As shown, the electronic device can detect the key points of the image and obtain the top of the head key point A, the neck key point B, the left shoulder key point C1, the left arm key point D1, the left hip key point E1, the left wrist key point F1 and the left knee key point G1. The electronic device can then determine that the portrait type is a seven-tenths / ninths portrait, and determine the center of mass position of the person as the average coordinate point R3 of the top of the head key point A, the neck key point B, the left shoulder key point C1, the left arm key point D1 and the left hip key point E1.
[0135] In an optional embodiment, when the key point detection results only include key points of the top of the head, neck, shoulders, hip joints, arms, knees and ankles, the electronic device can determine the portrait type as a full-body portrait, and determine the center of mass position of the person as the average coordinate point of the key points on the top of the head, neck, shoulders, hip joints, and arms.
[0136] Considering some full-body images, for example, the user is in a squatting position, or the user wears loose clothes and the shoulders, hips, arms, wrists or knees cannot be detected. Therefore, when the key point detection results only include the key points of the top of the head and the key points of the ankles, the electronic device can also determine that the portrait type is a full-body image. In this case, the electronic device can use the center point position of the human body frame of the person as the center of mass position of the person. The center point of the human body frame refers to the intersection of the two diagonals of the human body frame.
[0137] For example, Fig.12 As shown, the electronic device performs key point detection on the image to obtain the top of the head key point A, the neck key point B, the left shoulder key point C1, the right shoulder key point C2, the right arm key point D2, the left hip key point E1, the right hip key point E2, the left knee key point F1, the right knee key point F2, the left ankle key point G1 and the right ankle key point G2. Therefore, the electronic device can determine that the portrait type of the person is a full-body portrait, and the center of mass position of the person is the average coordinate point R4 of the top of the head key point A, the neck key point B, the left shoulder key point C1, the right shoulder key point C2, the right arm key point D2, the left hip key point E1, and the right hip key point E2.
[0138] In an optional implementation, when the key point detection result does not include key points of the top of the head and shoulders, the electronic device determines the portrait type as a partial close-up, and determines the centroid position of the person as the average coordinate point of all key points detected. For example, if the key point detection result only includes arms, the electronic device can determine the portrait type as a close-up of the arms, and the centroid position is the position coordinate of the arm.
[0139] S760, determining the truncation state of the person according to the human body detection result, key point detection and portrait type.
[0140] It can be understood that the portrait type can roughly represent the approximate truncation state of the body parts of the person in the picture. For example, if the portrait type is a close-up of the face, it means that the picture only includes the head of the person, and the parts below the head of the person are truncated. If the portrait type is a bust, it means that the picture includes the upper body of the person, and the parts below the waist of the person are truncated. If the portrait type is a 70 / 90 portrait, it means that the picture includes the part above the calf / ankle of the person, and the feet of the person are truncated. If the portrait type is a full-body portrait, it means that the picture includes the entire body of the person.
[0141] Specifically, regarding the truncation status of specific parts of the human body (such as limbs and head), the electronic device can specifically confirm it through the key point detection results. For example, if the key point detection results do not include the key points of the top of the head and the neck, it can be determined that the head of the person in the picture is truncated; for another example, if the key point detection results do not include the elbows and wrists, it can be determined that the hands of the person in the picture are truncated.
[0142] S770, the number of characters currently processed is increased by 1.
[0143] In this way, when an image includes N persons, the electronic device can determine the portrait types and centroid positions of the N persons.
[0144] In an optional implementation, the electronic device may also input the image into a motion recognition model to determine the motion state of the person. The motion recognition model is a neural network model that is pre-trained to convergence and can be used to recognize the motion state of the person in the image, including but not limited to walking, running, jumping, playing badminton, swimming, throwing, playing water fights, and being still.
[0145] In an optional implementation, the electronic device can also determine the area ratio of each character according to the human body detection result. The area ratio of the character is specifically the ratio of the area of the character in the image, which can be the ratio of the character area to the image area. In an optional implementation, the character area is the area of the human body frame corresponding to the character.
[0146] After the electronic device determines the shooting status of all the people in the image, it can confirm whether the image is a legal image.
[0147] In an optional implementation, the image may include a main character and an effective character, and the electronic device may perform effectiveness judgment on the main character and the effective character respectively. The main character mainly refers to the main character in the image, or the protagonist. The effective character is a character in the image whose importance is less than that of the main character, such as a passerby.
[0148] like Fig.13A As shown, the electronic device can determine whether each person meets the valid person condition in turn, and if the person meets the valid person condition, store it in the valid person set. If the person also meets the subject person condition, store it in the subject person set. After determining whether all the people in the image are subject people or valid people, the electronic device can perform validity judgments on the people in the valid person set and the people in the subject person set respectively.
[0149] In an optional embodiment, the electronic device may divide the characters into valid characters and main characters according to the area ratio of the characters and the center of mass position of the characters. The valid character condition may include that the area ratio of the character is greater than the threshold M1, and the main character condition may include that the area ratio of the character is greater than the threshold M1 and the center of mass position of the character is within a preset area of the image. Exemplarily, the preset area may be an area formed by four points of interest in the image, an area formed by the thirds line of the image, etc., and no specific limitation is made here. In other words, a character whose area ratio is greater than the threshold M1 can be called a valid character, and a character whose area ratio is greater than the threshold M1 and the center of mass position of the character is within the preset area of the image can be called a main character.
[0150] In this embodiment, the electronic device can set multiple invalid states for the valid characters and the main characters respectively. Compared with the main characters, the valid characters may have limb amputations, inadequate expressions, etc.
[0151] For example, for the main character, its various invalid states may include: when the character is jumping or running, the portrait type is not full-body, or there is a limb truncation; when the character is throwing or playing badminton, the portrait type is not full-body or half-body, or there is a head truncation; when the character is splashing water or playing table tennis, there is no face in the image or the elbow is truncation; the character is in a static state, with no eyes open or smiling, or there is a face truncation; the character is in a static state, and the area occupies too large when no face is detected; the character is in a static state, the portrait type is a close-up of the face or a bust, and the center of mass of the character is outside the preset area, etc.
[0152] It can be understood that if the shooting status of the subject person does not match any of the invalid states mentioned above, it can be determined that the shooting status of the subject person is valid.
[0153] For a valid person, multiple invalid states may include: when the person is jumping or running, the portrait type is not full body, the head is cut off, etc. It can be understood that if the shooting state of the valid person does not match any of the above invalid states, it can be determined that the shooting state of the valid person is valid.
[0154] It should be noted that the above-mentioned invalid states are only examples, and more can be set according to actual needs.
[0155] In an optional implementation, when the shooting status of all valid persons is valid and the shooting status of all subject persons is valid, the image is determined to be legal.
[0156] In an optional implementation, the electronic device may not distinguish between valid characters and subject characters, and directly determine whether the shooting status of all characters is valid, and confirm that the image is legal when the shooting status of all characters is valid. The principle of determining whether the shooting status of each character is valid is similar to the principle of determining whether the shooting status of the subject character / valid character is valid, and will not be repeated here.
[0157] The electronic device can also evaluate the composition quality of the image. The composition quality of the image can be evaluated from at least three aspects: basic composition, social relationships in multi-person scenes, and position arrangement of characters in multi-person scenes. The above three aspects will be explained below.
[0158] 1. Basic composition
[0159] Basic composition refers to the layout and structure of the picture, and specifically refers to the position of the characters on the picture. Common photography composition rules include but are not limited to the golden triangle composition rule, the rule of thirds composition, the diagonal rule, and the center composition rule. Different composition rules may have different marking points or guide lines to assist in composition.
[0160] like Fig. 13B As shown, the reference positions of the golden triangle composition rule, the thirds composition rule, the diagonal rule and the center composition rule are shown. Among them, when the person is near any of the four interest points, it can be considered that the image is more in line with the golden triangle composition rule. When the person is near any of the thirds lines, it can be considered that the image is more in line with the thirds composition rule. When the person is near any of the diagonals, it can be considered that the image is more in line with the center composition rule. When the person is near the center point, it can be considered that the image is more in line with the center composition rule.
[0161] In this embodiment, the electronic device can determine the distance parameter according to the distance from the center of mass position of the target person to the reference position, and use this to measure the degree of matching between the image and the preset composition rule. Different composition rules have different corresponding reference positions, and thus different corresponding distance parameters. It should be noted that the target person can be any person in the image, or can be the main person in the image.
[0162] Below, the target person is each person in the image, the image size is width*height (width x height), and the center of mass position is (Mass x , Mass y ) as an example, the process of an electronic device determining the degree of matching of an image with different composition rules when there is only one person in the image is explained.
[0163] For the golden triangle composition rule, the reference positions are four points of interest. The electronic device can calculate the distances between the centroid position and the four points of interest, and use the minimum distance of the four distances as the first distance parameter to characterize the degree of matching between the image and the golden triangle composition rule. The smaller the first distance parameter, the higher the degree of matching between the image and the golden triangle composition rule.
[0164] Among them, the first distance parameter satisfies:
[0165]
[0166] Among them, massDistance AllPoint is the first distance parameter, dis(i) is the distance from the centroid to the i-th interest point, i=1,2,3,4.
[0167] Among them, the distance from the centroid position to any point of interest satisfies:
[0168]
[0169] Among them, d(P ix , P iy ) is the coordinate of the i-th interest point.
[0170] For the rule of thirds, the reference position is the four thirds lines. The electronic device can calculate the distance between the centroid position and the four thirds lines, and use the minimum distance of the four distances as the second distance parameter to characterize the degree of matching between the image and the rule of thirds. The smaller the second distance parameter, the higher the degree of matching between the image and the rule of thirds.
[0171] Among them, the second distance parameter satisfies the formula:
[0172]
[0173] Among them, massDistance ThirdLine is the second distance parameter, d(mass, Li) refers to the distance from the center of mass to the i-th three-point line, i = 1, 2, 3, 4.
[0174] Taking the i-th three-point line as y=ki+bi as an example, the center of mass position (Mass x , Mass y ) to the i-th three-point line is:
[0175]
[0176] For the diagonal rule, the reference position is the two diagonals. The electronic device can calculate the distance from the centroid position to the two diagonals, and use the minimum distance of the two distances as the third distance parameter to characterize the degree of matching between the image and the diagonal rule. The smaller the third distance parameter, the higher the degree of matching between the image and the diagonal rule.
[0177] Among them, the third distance parameter satisfies the formula:
[0178]
[0179] Among them, massDistance DiagonaLine is the third distance parameter, d(mass, Li) refers to the distance from the center of mass to the i-th diagonal, i=1,2.
[0180] For the central composition rule, the reference position is the center point of the image. The electronic device can calculate the distance from the centroid position to the center point of the image, and use the distance as the fourth distance parameter to characterize the degree of matching between the image and the central composition rule. The smaller the fourth distance parameter, the higher the degree of matching between the image and the central composition rule, and the more evenly the person is distributed in the entire image.
[0181] Among them, the fourth distance parameter satisfies:
[0182]
[0183] Among them, massDistance Center is the fourth distance parameter, (C x , C y ) are the coordinates of the center point.
[0184] When an image includes N characters, the degree to which the image matches different composition rules is related to the area ratio of each character and the distance between the center of mass position of the character and each marking point or guide line.
[0185] Specifically, for the golden triangle composition rule, the electronic device can calculate the area ratio of N characters and the minimum distance from the center of mass of the N characters to the four points of interest, and then perform a weighted average of the N minimum distances using the area ratio of the characters as a weight, and use the obtained result as the first distance parameter to characterize the degree of matching between the image and the golden triangle composition rule. Specifically, the calculation formula can be as follows:
[0186]
[0187] Where Sp is the degree of matching between the image and the golden triangle composition rule when the image includes N characters; w j is the area proportion of the jth person, j∈[1,N], Pj is the center of mass position of the jth person, P i P is the i-th interest point, i∈[1,4], massDistance AllPoint (j) is the minimum distance from the center of mass of the jth person to the four interest points.
[0188] For the rule of thirds, the electronic device can calculate the area ratio of N characters and the minimum distance from the center of mass of N characters to four thirds lines, and then perform weighted average of the N minimum distances using the area ratio of the characters as weights, and use the obtained result as the second distance parameter to characterize the degree of matching between the image and the rule of thirds. Specifically, the calculation formula can be as follows:
[0189]
[0190] Among them, S T is the degree of matching of the image with the rule of thirds when N characters are included in the image; j is the area proportion of the jth person, j∈[1,N], P j is the center of mass position of the jth person, P i T is the i-th three-point line, i∈[1,4], massDistance ThirdLine (j) is the minimum distance from the center of mass of the jth person to the four third lines.
[0191] For the diagonal rule, the electronic device can calculate the area ratio of N characters and the minimum distance from the center of mass of N characters to two diagonals, and then perform weighted average of the N minimum distances with the area ratio of the characters as weight, and use the obtained result as the third distance parameter to characterize the matching degree of the image with the diagonal rule. Specifically, the calculation formula can be as follows:
[0192]
[0193] Among them, S D is the degree of matching between the image and the diagonal rule when there are N characters in the image; w j is the area proportion of the jth person, j∈[1,N], P j is the center of mass position of the jth person, P i D is the i-th diagonal, i∈[1,2], massDistance DiagonaLine (j) is the minimum distance from the center of mass of the jth person to the two diagonals.
[0194] For the central composition rule, the electronic device can calculate the area ratio of the N characters and the distance from the center of mass of the N characters to the center position, and then perform a weighted average of the N distances using the area ratio of the characters as the weight, and use the obtained result as the fourth distance parameter to characterize the degree of matching between the image and the central composition rule. Specifically, the calculation formula can be as follows:
[0195]
[0196] Among them, S C is the degree of matching between the image and the central composition rule when N characters are included in the image; w j is the area proportion of the jth person, j∈[1,N], P j is the center of mass position of the jth person, P C is the center point, massDistance Center (j) is the distance from the center of mass of the jth person to the center point.
[0197] It can be understood that the smaller the above distance parameters (including the first distance parameter, the second distance parameter, the third distance parameter and the fourth distance parameter) are, the higher the matching degree between the image and the composition rule is, that is, the higher the composition quality of the image is.
[0198] It should be noted that when the target person is the main person, the electronic device can count the number of main persons in the image, and when the number of main persons is 1 or greater than 1, calculate the distance parameter using the above-mentioned different methods respectively, which will not be repeated here.
[0199] 2. Social Relationships in Multi-Person Scenarios
[0200] When the image includes more than two target persons, the electronic device may also evaluate the social relationship characteristics of the image. The social relationship characteristics may implicitly express the relationship between the target persons in the image, such as whether the relationship between the persons is close, etc., which may affect the viewer's preference emotionally.
[0201] In an optional implementation, the electronic device may determine an intimacy parameter of the image, and use the intimacy parameter to reflect the close relationship between the characters in the image.
[0202] Specifically, the electronic device can determine the face position of each target person in the image, and determine the intimacy parameter of the image based on multiple face positions. The target person can be each person in the image or the main person in the image. The face position can be the center point position of the face frame or the center of mass position of the person's head. The center of mass position of the person's head refers to the average point coordinates of the key points on the top of the head and the key points on the neck. The specific algorithm is described in the previous article and will not be repeated here.
[0203] Fig.14 FIG. 1 shows a flow chart of an image capture method provided by an embodiment of the present application. It specifically shows the process of an electronic device determining an intimacy parameter of an image. Fig.14 As shown, the image capture method provided in the embodiment of the present application includes:
[0204] S1401, constructing a second-order tree structure with N face positions as nodes and the line connecting any two face positions as edges; wherein the weight of each edge is the distance between the two face positions corresponding to the edge.
[0205] For example, Fig.15 The image shown in (a) includes five face frames, and the center points of the five face frames are A, B, C, D, and E respectively. The electronic device can use A, B, C, D, and E as nodes, connect AB, AC, AD, AE, BC, BD, BE, CD, CE, and DE, and then calculate the Euclidean distance between AB as the weight of the AB edge, calculate the Euclidean distance between AC as the weight of the AC edge, calculate the Euclidean distance between AD as the weight of the AD edge, calculate the Euclidean distance between AE as the weight of the AE edge, calculate the Euclidean distance between BC as the weight of the BC edge, calculate the Euclidean distance between BD as the weight of the BD edge, calculate the Euclidean distance between BE as the weight of the BE edge, calculate the Euclidean distance between CD as the weight of the CD edge, calculate the Euclidean distance between CE as the weight of the CE edge, and calculate the Euclidean distance between DE as the weight of the DE edge. The second-order tree structure constructed according to A, B, C, D, and E can be as follows: Fig.15 As shown in (b) in .
[0206] S1402, construct a minimum spanning tree of a second-order tree structure, the minimum spanning tree includes N-1 edges.
[0207] The minimum spanning tree includes all nodes in the second-order tree structure and includes the minimum number of edges that keep the graph connected.
[0208] Among them, the electronic device can use Prim's algorithm or Kruskal's algorithm to construct a minimum spanning tree. Kruskal's algorithm refers to sorting all the edges in the connected network (i.e., the second-order tree structure) in ascending order according to the weight size, and starting from the edge with the smallest weight. As long as this edge does not form a loop with the selected edges, it can be selected to form a minimum spanning tree. For a connected network with N vertices, N-1 edges that meet the conditions are selected, and the spanning tree composed of these edges is the minimum spanning tree.
[0209] For example, the electronic device will Fig.15 All the edges in the second-order tree structure shown in (b) are sorted in ascending order according to the weight size, and Table 1 is obtained:
[0210] Table 1
[0211] B,C C,D D,E E,A D,A …… 3 3 4 4 6 ……
[0212] Among them, the minimum weights are the weights of the BC edge and the CD edge, both of which are 3. Assuming that the electronic device starts to be selected from BC, since no edge has been selected to form a minimum spanning tree, and BC itself will not form a loop, the BC edge can form a minimum spanning tree; since the CD edge will not form a loop with the selected BC edge, it can form a minimum spanning tree; since the DE edge will not form a loop with the selected BC edge and CD edge, it can form a minimum spanning tree; since the EA edge will not form a loop with the selected BC edge, CD edge and DE edge, it can form a minimum spanning tree; since the DA edge will form a loop with the selected edge, it cannot form a minimum spanning tree. In this way, we can get Fig.16 The minimum spanning tree shown.
[0213] Prim's algorithm refers to finding an edge with the smallest weight from a connected network containing N vertices each time. This operation is repeated N-1 times. The spanning tree composed of N-1 edges with the smallest weight is the minimum spanning tree.
[0214] For example, Fig.17 As shown, the electronic device first determines the edge with the smallest weight from AE, AD, AC, and AB, which is AE. Then, the electronic device determines the edge with the smallest weight from ED, EC, and EB, which is ED. Next, the electronic device determines the edge with the smallest weight from DC and DB, which is DC. Finally, AE, ED, DC, and CB are connected to form a minimum spanning tree.
[0215] S1403: Determine the average value of the weights of the N-1 edges as the intimacy parameter.
[0216] The specific calculation formula is:
[0217]
[0218] Among them, Face Closeness is the intimacy parameter, and N is the total number of faces.
[0219] Understandably, Face Closeness The smaller it is, the closer the faces in the picture are, and the closer the relationship between the characters is. The image contains richer emotions, and therefore the composition quality is higher.
[0220] 3. Character Position Arrangement in Multiplayer Scenes
[0221] When the image includes more than three target persons, the electronic device can determine the compactness parameter of the image according to the centroid position of the target persons, which is used to evaluate the position arrangement of the target persons in the image. Similarly, the target person can be each person in the image or the main person in the image.
[0222] Fig.18 FIG. 1 shows a flow chart of an image capture method provided by an embodiment of the present application. It specifically shows the process of an electronic device determining an intimacy parameter of an image. Fig.18 As shown, the image capture method provided in the embodiment of the present application includes:
[0223] S1801, normalize the N centroid positions.
[0224] In this embodiment, in order to eliminate the dimension effect, the electronic device can use the length and width of the image to normalize the center of mass position of the person. The center of mass position after normalization satisfies:
[0225]
[0226] S1802, determining the standard deviation of the N centroid positions after normalization in the X-axis direction and the standard deviation in the Y-axis direction.
[0227] It can be understood that the standard deviation in the X-axis direction (which can be called the first direction) can reflect the arrangement of the characters in the X-axis direction, and the standard deviation in the Y-axis direction (which can be called the second direction) can reflect the arrangement of the characters in the Y-axis direction.
[0228] S1803: Determine the smaller value of the standard deviation in the X-axis direction and the standard deviation in the Y-axis direction as a compactness parameter.
[0229] In this way, the obtained compactness parameter can be used to indicate the position arrangement of at least three characters in the image, and the smaller the compactness parameter is, the more reasonable the position arrangement of at least three characters is, and the higher the composition quality of the image is.
[0230] After determining the composition indices of the multiple frames of images, the electronic device may compare the composition indices of the images to retain one or more frames of images with higher composition quality.
[0231] Specifically, the electronic device can compare the composition indicators of any two frames of the multiple images, eliminate the frame with lower composition quality among the any two frames of images, and then continue to compare the composition indicators of any two frames of the multiple images after eliminating the frame with lower composition quality, until the comparison of the multiple frames of images is completed, and finally determine one or more frames of images with higher composition quality.
[0232] The comparison process is described in detail below by taking an electronic device comparing the composition indicators of a first image and a second image as an example.
[0233] Among them, the composition parameters of the first image include a first distance parameter a, a second distance parameter a, a third distance parameter a, a fourth distance parameter a, a first intimacy parameter and a first compactness parameter; among them, the first distance parameter a is used to characterize the degree of matching between the first image and the golden triangle composition rule, the second distance parameter a is used to characterize the degree of matching between the first image and the rule of thirds composition, the third distance parameter a is used to characterize the degree of matching between the first image and the diagonal rule, the fourth distance parameter a is used to characterize the degree of matching between the first image and the central composition rule, the first intimacy parameter is used to characterize the closeness of the relationship between multiple characters in the first image, and the first compactness parameter is used to characterize the rationality of the position arrangement between multiple characters in the first image.
[0234] The composition parameters of the second image include a first distance parameter b, a second distance parameter b, a third distance parameter b, a fourth distance parameter b, a second intimacy parameter and a second compactness parameter; wherein the first distance parameter b is used to characterize the degree of matching between the second image and the golden triangle composition rule, the second distance parameter b is used to characterize the degree of matching between the second image and the rule of thirds composition, the third distance parameter b is used to characterize the degree of matching between the second image and the diagonal rule, the fourth distance parameter b is used to characterize the degree of matching between the second image and the central composition rule, the second intimacy parameter is used to characterize the closeness of the relationship between multiple characters in the second image, and the second compactness parameter is used to characterize the rationality of the position arrangement between multiple characters in the second image.
[0235] It should be noted that, according to the difference between the total number of people in the first image and the total number of people in the second image, the electronic device may compare different composition parameters of the first image and the second image.
[0236] Wherein, when the total number of people in the first image and the second image is 1, the electronic device only compares the distance parameters of the two images. Specifically, the electronic device may calculate a first difference between the first distance parameter a and the first distance parameter b, and when the first difference is greater than a first threshold, if the first distance parameter a is smaller, the composition quality of the first image is higher than the composition quality of the second image; if the first distance parameter b is smaller, the composition quality of the second image is higher than the composition quality of the first image.
[0237] The first difference is the absolute value of the difference between the first distance parameter a and the first distance parameter b. The first threshold is used to measure the similarity between the first distance parameter a and the first distance parameter b. When the first difference is less than or equal to the first threshold, it means that the first image and the second image may use the same composition rule, and thus the comparability is low; when the first difference is greater than the first threshold, it means that the first image and the second image do not use the same composition rule, and thus are compared.
[0238] When the first difference is less than or equal to the first threshold, the electronic device may calculate the second difference between the second distance parameter a and the second distance parameter b. When the second difference is greater than the second threshold, if the second distance parameter a is smaller, the composition quality of the first image is higher than the composition quality of the second image; if the second distance parameter b is smaller, the composition quality of the second image is higher than the composition quality of the first image.
[0239] When the second difference is less than or equal to the second threshold, the electronic device may calculate a third difference between the third distance parameter a and the third distance parameter b. When the third difference is greater than the third threshold, if the third distance parameter a is smaller, the composition quality of the first image is higher than the composition quality of the second image; if the third distance parameter b is smaller, the composition quality of the second image is higher than the composition quality of the first image.
[0240] When the third difference is less than or equal to the third threshold, the electronic device may calculate a fourth difference between the fourth distance parameter a and the fourth distance parameter b. When the fourth difference is greater than the fourth threshold, if the fourth distance parameter a is smaller, the composition quality of the first image is higher than the composition quality of the second image; and if the fourth distance parameter b is smaller, the composition quality of the second image is higher than the composition quality of the first image.
[0241] When the fourth difference is less than the fourth threshold, the electronic device cannot determine which image has a higher composition quality based on the distance parameters of the two images, and can further determine the image quality based on parameters such as clarity and signal-to-noise ratio.
[0242] When the total number of people in one image is 2 and the total number of people in the other image is greater than 2, the electronic device may compare the composition qualities of the two images by using the distance parameters and the intimacy parameters of the two images.
[0243] First, the electronic device can compare the distance parameters of the two images, as described above, and will not be repeated here. If the distance parameters of the two images cannot determine which image has a higher composition quality, the electronic device can further compare the intimacy parameters of the two images.
[0244] Specifically, when the fourth difference is less than the fourth threshold, the electronic device may calculate the fifth difference between the first compactness and the second compactness, and when the fifth difference is greater than or equal to the fifth threshold, if the first compactness is smaller, the composition quality of the first image is higher than the composition quality of the second image; if the second compactness is smaller, the composition quality of the second image is higher than the composition quality of the first image.
[0245] When the fifth difference is less than the fifth threshold, the electronic device may further determine the image quality according to parameters such as clarity and signal-to-noise ratio.
[0246] When the total number of persons in the two images is greater than 2, the electronic device may compare the composition qualities of the two images by using a compactness parameter.
[0247] Specifically, the electronic device can calculate the sixth difference between the first compactness parameter and the second compactness parameter. When the sixth difference is greater than the sixth threshold, if the first compactness parameter is smaller, the composition quality of the first image is higher than the composition quality of the second image; if the second compactness parameter is smaller, the composition quality of the second image is higher than the composition quality of the first image.
[0248] In an optional implementation, after acquiring multiple frames of images, the electronic device may retain the legal images therein. The process of determining the legal images is as described above and will not be described in detail here.
[0249] In an optional implementation, after acquiring multiple frames of images, the electronic device may compare the composition indicators of the multiple frames of images, and finally save one or more frames of images with higher composition quality. The process of comparing the composition indicators of two frames of images is described above and will not be repeated here.
[0250] In an optional embodiment, if Fig.19 As shown, after acquiring multiple frames of images, the electronic device can first acquire the legitimacy detection results and composition indicators of the multiple frames of images. Then, the image frames are compared in pairs. If one of the two frames of images is legal and the other is illegal, it can be determined that the composition quality of the legal image is higher. If both frames of images are legal or illegal, the image with higher composition quality is determined based on the composition indicators of the two frames of images. The process of comparing the composition indicators of the two frames of images is described above and will not be repeated here.
[0251] In an optional embodiment, for each frame of image, the electronic device can identify the shooting status of all objects in the image, evaluate the composition quality of the image, and determine the image that needs to be retained from multiple frames of images based on the shooting status of all objects and the composition quality of the image.
[0252] In another optional implementation, for each frame of image, the electronic device may first identify the shooting status of all the objects in the image. When the shooting status of all the objects in the image is reasonable, the electronic device further evaluates the composition quality of the image. In this way, for images in which the shooting status of some or all of the objects is unreasonable, the electronic device does not need to evaluate the composition quality, so as to reduce the amount of calculation, thereby being able to more quickly determine the images that need to be retained from multiple frames of images.
[0253] To sum up, the present application does not need to pre-set the photo template, but evaluates the image composition quality from multiple dimensions after capturing multiple frames of images, and retains the images with good basic composition, close character relationships, and reasonable personnel arrangement. The images obtained in this way can avoid the rigidity of the photo template, give users free play space, and help users obtain high-quality images.
[0254] The present application also provides an electronic device, which may include: a memory and one or more processors. The memory and the processor are coupled. The memory is used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device can execute the various functions or steps executed by the mobile phone in the above method embodiment.
[0255] The present application also provides a chip system, such as Fig. 20 As shown, the chip system 2000 includes at least one processor 2001 and at least one interface circuit 2002. The processor 2001 and the interface circuit 2002 can be interconnected via lines. For example, the interface circuit 2002 can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit 2002 can be used to send signals to other devices (such as processor 2001). Exemplarily, the interface circuit 2002 can read instructions stored in the memory and send the instructions to the processor 2001. When the instructions are executed by the processor 2001, the electronic device or server can perform the various steps in the above embodiments. Of course, the chip system may also include other discrete devices, which are not specifically limited in the embodiments of the present application.
[0256] This embodiment also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device or the server executes each function or step in the above method embodiment.
[0257] This embodiment also provides a computer program product. When the computer program product is run on a computer, it enables the computer to execute each function or step in the above method embodiment.
[0258] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor can execute the computer-executable instructions stored in the memory so that the chip executes each function or step performed by the mobile phone in the above method embodiment.
[0259] Among them, the electronic device, communication system, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here.
[0260] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0261] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0262] The unit described as a separate component may or may not be physically separated, and the component shown as a unit may be one physical unit or multiple physical units, that is, it may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment.
[0263] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0264] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.
[0265] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present application and are not intended to limit it. Although the present application has been described in detail with reference to the preferred embodiments, a person of ordinary skill in the art should understand that the technical solution of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present application.
Claims
1. An image capture method, characterized in that: Applied to an electronic device, the electronic device includes a camera, and the method includes: Displaying multiple frames of images captured by the camera in real time; Determine the composition index of the corresponding image according to the character information of each frame of the image; wherein the character information includes the number of target characters and one or more of a plurality of character parameters, the plurality of character parameters include the centroid position of the target characters, the area proportion of the target characters and the face position of the target characters, the composition index includes one or more of a plurality of composition parameters, the plurality of composition parameters include a distance parameter, an intimacy parameter and a compactness parameter, the distance parameter is used to indicate the degree of matching between the image and a preset composition rule, the intimacy parameter is used to indicate the intimacy between at least two target characters in the image, and the compactness parameter is used to indicate the discrete degree of position arrangement between at least three target characters in the image; Saving one or more frames of images with the highest composition quality among the multiple frames of images; wherein the smaller the distance parameter, the smaller the intimacy parameter, or the smaller the compactness parameter, the higher the composition quality of the image; When the number of persons N is greater than or equal to 2, the composition index includes the intimacy parameter, and the character information includes the face positions of N target persons; The step of determining the composition index of the corresponding image according to the character information of each frame of the image includes: A second-order tree structure is constructed with N face positions as nodes and the line connecting any two face positions as edges. The weight of each edge is the distance between the two face positions corresponding to the edge. Constructing a minimum spanning tree of the second-order tree structure, wherein the minimum spanning tree includes N-1 edges; The average value of the weights of the N-1 edges is determined as the intimacy parameter.
2. The method according to claim 1, characterized in that The composition index includes the distance parameter. When the number of people N is greater than or equal to 2, the character information includes the centroid positions of the N target characters and the area proportions of the N target characters. The step of determining the composition index of the corresponding image according to the character information of each frame of the image includes: For each of the N target persons, a corresponding basic distance parameter is obtained according to the distance from the center of mass position of the target person to a preset reference position; The distance parameter is obtained by taking the area ratio of each target person as a weight and performing a weighted average of the basic distance parameters corresponding to all target persons.
3. The method according to claim 1, characterized in that The composition index includes the distance parameter. When the number of people N=1, the character information includes the centroid position of each target person. The composition index of the corresponding image is determined according to the character information of each frame of the image, including: Obtaining a corresponding basic distance parameter according to the distance from the center of mass position of the target person to a preset reference position; The basic distance parameter is determined as the distance parameter.
4. The method according to claim 2 or 3, characterized in that: The preset reference position includes a plurality of reference positions; the corresponding basic distance parameter is obtained according to the distance from the center of mass position of the target person to the preset reference position, including: The minimum value of the distances from the center of mass position of the target person to the multiple reference positions is used as the corresponding basic distance parameter; or, The preset reference position includes a reference position; the corresponding basic distance parameter is obtained according to the distance from the center of mass position of the target person to the preset reference position, including: The distance from the center of mass position of the target person to the reference position is used as the corresponding basic distance parameter.
5. The method according to claim 2 or 3, characterized in that: The preset reference positions include: four interest points of the image, two diagonal lines of the image, four trisection lines of the image or the center point of the image.
6. The method according to claim 1, characterized in that When the number of persons N≥3, the composition index further includes the compactness parameter, the character information further includes the centroid positions of the N target characters, and the composition index of the corresponding image is determined according to the character information of each frame of the image, further including: Determine the standard deviation of the N centroid positions in the first direction and the standard deviation in the second direction respectively; A smaller value of a standard deviation in the first direction and a standard deviation in the second direction is determined as the compactness parameter.
7. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Comparing the composition indexes of any two frames of images among the multiple frames of images, and eliminating the frame of image with low composition quality among the any two frames of images; Continue to compare the composition indicators of any two frames of images in the multiple frames of images after eliminating the one frame of image with low composition quality until all the multiple frames of images have completed comparison.
8. The method according to claim 7, characterized in that In the case where the number of persons in any two frames of images is 1, the composition index includes the distance parameter, the distance parameter includes a first distance parameter, a second distance parameter, a third distance parameter and a fourth distance parameter, the first distance parameter is used to reflect the degree of matching between the image and the first composition rule, the second distance parameter is used to reflect the degree of matching between the image and the second composition rule, the third distance parameter is used to reflect the degree of matching between the image and the third composition rule, the fourth distance parameter is used to reflect the degree of matching between the image and the fourth composition rule, and the first composition rule, the second composition rule, the third composition rule and the fourth composition rule include different reference positions; The composition index of comparing any two frames of images in the multiple frames of images includes: When the difference between the first distance parameters of the arbitrary two frames of images is greater than or equal to the first threshold, comparing the first distance parameters of the arbitrary two frames of images, wherein the image with the smaller first distance parameter has higher composition quality; When the difference between the first distance parameters of the two frames of images is less than the first threshold, determining whether the difference between the second distance parameters of the two frames of images is greater than or equal to the second threshold; When the difference between the second distance parameters of the arbitrary two frames of images is greater than or equal to the second threshold, comparing the second distance parameters of the arbitrary two frames of images, wherein the image with the smaller second distance parameter has a higher composition quality; When the difference between the second distance parameters of the two frames of images is less than the second threshold, determining whether the difference between the third distance parameters of the two frames of images is greater than or equal to the third threshold; When the difference between the third distance parameters of the arbitrary two frames of images is greater than or equal to the third threshold, comparing the third distance parameters of the arbitrary two frames of images, wherein the image with the smaller third distance parameter has a higher composition quality; When the difference between the third distance parameters of the two frames of images is less than the third threshold, determining whether the difference between the fourth distance parameters of the two frames of images is greater than or equal to the fourth threshold; When the difference between the fourth distance parameters of the arbitrary two frames of images is greater than or equal to the fourth threshold, the fourth distance parameters of the arbitrary two frames of images are compared, and the image with the smaller fourth distance parameter has a higher composition quality.
9. The method according to claim 8, characterized in that If the number of people N in one of the two frames of images is 2, and the number of people N in the other frame of images is ≥ 2, the composition index further includes an intimacy parameter, and the composition index of comparing any two frames of images in the multiple frames of images further includes: When the difference between the fourth distance parameters of the two frames of images is less than the fourth threshold, determining whether the difference between the intimacy parameters of the two frames of images is greater than or equal to a fifth threshold; When the difference between the intimacy parameters of the arbitrary two frames of images is greater than or equal to the fifth threshold, the intimacy parameters of the arbitrary two frames of images are compared, and the image with the smaller intimacy parameter has a higher composition quality.
10. The method according to claim 7, characterized in that If the number of persons in any two frames of images is greater than or equal to 2, the composition index further includes the compactness parameter, and the composition index of comparing any two frames of images in the multiple frames of images includes: When the difference between the compactness parameters of the arbitrary two frames of images is greater than or equal to the sixth threshold, the compactness parameters of the arbitrary two frames of images are compared, and the image with the smaller compactness parameter has a higher composition quality.
11. The method according to any one of claims 1 to 3, characterized in that: The target person is each person in the image, or the target person is a person in the image whose area ratio is greater than a preset threshold and whose centroid position is within a preset area.
12. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Performing human body detection, face detection and key point detection on the multiple frames of images to obtain human body detection results, face detection results and key point detection results respectively; Determine the shooting state of each person in the multiple frames of images according to the human body detection result, the face detection result and the key point detection result; wherein the shooting state includes the motion state of the person and one or more of the following multiple states, and the multiple states include: the centroid position of the person, the portrait type and the area proportion of the person; The step of saving one or more frames of images with the highest composition quality among the multiple frames of images comprises: One or more legal images with the highest composition quality among the multiple frames of images are saved; wherein the legal images are images in which the shooting status of all characters is valid.
13. The method according to claim 12, characterized in that If the key point detection result only includes the top of the head key point and the neck key point, the portrait type is a close-up of the face, and the center of mass position of the person is the average coordinate point of the top of the head key point and the neck key point.
14. The method according to claim 12, characterized in that If the key point detection result only includes the top of the head key point, the neck key point, the shoulder key point and one or more of the following multiple first key points, then the portrait type is a bust portrait, and the center of mass position of the character is the average coordinate point of the neck key point and the shoulder key point, and the multiple first key points include the arm key point and the wrist key point.
15. The method according to claim 12, characterized in that If the key point detection result only includes the top of the head key point, the neck key point, the shoulder key point, the hip joint key point, the arm key point and one or more of the following multiple second key points, then the portrait type is a seven / ninth-point portrait, and the center of mass position of the character is the average coordinate point of the top of the head key point, the neck key point, the shoulder key point, the hip joint key point, and the arm key point, and the multiple second key points include the wrist key point and the knee key point.
16. The method according to claim 12, characterized in that If the key point detection result only includes the top of the head key point, the ankle key point and one or more of the following multiple third key points, then the portrait type is a full-body portrait, and the center of mass position of the character is the center point position of the character's body frame, and the multiple third key points include shoulder key points, hip joint key points, arm key points, wrist key points, and knee key points.
17. The method according to claim 12, characterized in that If the key point detection result does not include the top of the head key point and the neck key point, the portrait type is a partial close-up, and the center of mass position of the person is the average coordinate point of all the key points detected.
18. The method according to claim 12, characterized in that The human body detection result includes a human body frame of the person, and the area ratio of the person is the ratio of the area of the human body frame to the image area.
19. The method according to claim 12, characterized in that The face detection result includes a face frame, and the face position is the center point position of the face frame, or the centroid position of the person's head.
20. The method according to claim 12, characterized in that If the person is in motion, and the portrait type of the person is not a full-length portrait or a half-length portrait and does not include at least one of the key points of the top of the head, the key points of the neck, the key points of the ankles, and the key points of the wrists, the shooting status of the person is invalid.
21. The method according to claim 12, characterized in that If the person is in a stationary state, and the person does not open his eyes, does not smile, the portrait type is a bust portrait and the area ratio is greater than the seventh threshold or does not include the key points of the top of the head and the key points of the neck, the shooting status of the person is invalid.
22. An electronic device, characterized in that: The electronic device comprises: a memory and a processor; the processor is coupled to the memory; wherein the memory is used to store computer program code, the computer program code comprises computer instructions; when the computer instructions are executed by the processor, the electronic device executes the method as described in any one of claims 1-21.
23. A computer-readable storage medium, characterized in that: The method comprises computer instructions; when the computer instructions are executed on an electronic device, the electronic device executes the method as claimed in any one of claims 1 to 21.
Citation Information
Patent Citations
Figure image auxiliary shooting method and system based on image aesthetics
CN105100625A
Portrait composition limb truncation detection method and device, terminal and storage medium
CN111294518A
Photographing method and device, electronic equipment and storage medium
CN111343382A
Scoring method and device based on shooting composition, equipment and storage medium
CN111432114A
Image capturing method and device
CN111801932A
