Image capturing method and electronic device

By evaluating the composition quality of multi-frame images in an electronic device and using distance, closeness, and compactness parameters, the problem of character distribution and multi-person position relationships not considered in the existing technology is solved, and higher-quality image capture is achieved.

WO2024174626A1PCT designated stage expired Publication Date: 2024-08-29HONOR DEVICE CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/133794
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-02-23
Filing Date
2023-11-23
Publication Date
2024-08-29

AI Technical Summary

Technical Problem

The existing technology fails to effectively consider the distribution of characters in the picture and the positional relationships between multiple characters when taking pictures, resulting in images that may be unbalanced and of low quality.

Method used

By displaying multiple frames of images collected by the camera in real time, the composition index is determined based on the character information of each frame of image, including distance parameters, intimacy parameters and compactness parameters, to evaluate the composition quality of the image, and save the frame or frames with the highest composition quality. images to avoid the rigidity of photo templates and give users a better shooting experience.

Benefits of technology

This enables the image composition to be more reasonable and beautiful when shooting in multi-person scenes, avoiding image imbalance and improving image quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023133794_29082024_PF_FP_ABST
    Figure CN2023133794_29082024_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of images. Provided are an image capturing method and an electronic device. By means of the method, an image with high composition quality can be automatically captured. The method comprises: displaying in real time a plurality of frames of images, which are collected by a camera; according to person information of each frame of image, determining a composition index of the corresponding image, wherein the person information comprises the number of target persons, and one or more of a plurality of person parameters, the plurality of person parameters comprise centroid positions of the target persons, area proportions of the target persons and facial positions of the target persons, the composition index comprises one or more of a plurality of composition parameters, and the plurality of composition parameters comprise a distance parameter, an intimacy parameter and a compactness parameter; and saving one or more frames of images with the highest composition quality among the plurality of 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.
Need to check novelty before this filing date? Find Prior Art

Description

Image capture method and electronic equipment

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on February 23, 2023, with application number 202310206533.4 and invention name “A method for capturing images and an electronic device”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The embodiments of the present application relate to the field of image technology, and in particular to an image capture method and electronic device. Background Art

[0003] With the rapid development of electronic technology, the camera pixels on electronic devices such as mobile phones and tablets are increasing, leading to an increasing number of users using these devices for photography. To meet these demands, major device manufacturers are continuously upgrading the hardware of these electronic devices to improve image quality and clarity. However, user demands for photography extend beyond image quality and clarity to include aesthetic requirements, such as image composition.

[0004] Considering that most users lack professional photography skills and may not be able to compose their shots properly, related technologies can use basic composition schemes to guide users in shooting. For example, face or body detection can be performed on the person in the picture to determine the face position or body position; when the face position or body position matches a pre-defined photo template, the photo is triggered. However, this method does not take into account the distribution of the person's weight in the picture; also, if there are multiple people in the picture, it does not consider the positional relationship between the multiple people, which can easily lead to an unbalanced picture.

[0005] Summary of the Invention

[0006] 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.

[0007] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:

[0008] 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 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 matching 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.

[0009] 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 avoid the rigidity of the photo template, give users free play, and help users obtain high-quality images.

[0010] 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 based on the character information of each frame of the image, including: for each target character among the N target characters, according to the distance from the center of mass position of the target character to the preset reference position, a corresponding basic distance parameter is obtained; with the area ratio of each target character as a weight, the basic distance parameters corresponding to all target characters are weighted averaged to obtain a distance parameter. It can be understood that when there are multiple target characters, weighted averaging is performed 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.

[0011] In an embodiment provided in 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 the preset reference position; and determining the basic distance parameter as the distance parameter.

[0012] In an embodiment provided in the first aspect, the preset reference position includes multiple reference positions; the corresponding basic distance parameter is obtained based on the distance from the center of mass position of the target person to the preset reference position, 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; the corresponding basic distance parameter is obtained based on the distance from the center of mass position of the target person to the preset reference position, including: taking the distance from the center of mass position of the target person to a reference position as the corresponding basic distance parameter.

[0013] In one embodiment provided in the first aspect, the preset reference positions include: four points of interest in the image, two diagonals of the image, four lines dividing the image into thirds, or the center point of the image. Specifically, the preset reference positions for the first composition rule (golden composition rule) are the four points of interest in the image, the preset reference positions for the second composition rule (rule of thirds) are the four lines dividing the image into thirds, the preset reference positions for the third composition rule (diagonal rule) are the two diagonals of the image, and the preset reference position for the fourth composition rule (central composition rule) is the center point of the image.

[0014] In an embodiment provided in 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 based on the character information of each frame 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.

[0015] In an embodiment provided in the first aspect, when the number of people N ≥ 3, the composition index also includes a compactness parameter, and the character information also includes the center of mass positions of N target characters. The composition index of the corresponding image is determined based on the character information of each frame image, and further includes: determining the standard deviation of the N center of mass positions in the first direction and the standard deviation in the second direction respectively; 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.

[0016] In an embodiment provided in the first aspect, the method further includes: comparing the composition indicators of any two frames of images in the multiple frames, and eliminating the frame image 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 image with low composition quality, until all the multiple frames of images are compared.

[0017] In an embodiment 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 multiple 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 the smaller first distance parameter has 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 better than the first threshold whether the difference in the second distance parameters of any two frames of images is greater than or equal to the second threshold; when the difference in the second distance parameters of any two frames of images is greater than or equal to the second threshold, comparing 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 in the second distance parameters of any two frames of images is less than the second threshold, determining whether the difference in the third distance parameters of any two frames of images is greater than or equal to the third threshold; when the difference in the third distance parameters of any two frames of images is greater than or equal to the third threshold, comparing 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 in the third distance parameters of any two frames of images is less than the third threshold, determining whether the difference in the fourth distance parameters of any two frames of images is greater than or equal to the fourth threshold; when the difference in the fourth distance parameters of any two frames of images is greater than or equal to the fourth threshold, comparing the fourth distance parameters of any two frames of images, wherein the image with the smaller fourth distance parameter has higher composition quality.

[0018] In an embodiment provided in the first aspect, if the number of people in one frame of any two frames is N=2, and the number of people in the other frame 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 also includes: when the difference in the fourth distance parameters of any two frames of images is less than the fourth threshold, judging whether the difference in the intimacy parameters of any two frames of images is greater than or equal to the fifth threshold; when the difference in 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.

[0019] In an embodiment provided in 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 indicators of any two frames of images in multiple 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.

[0020] In an implementation provided by 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.

[0021] 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 status of each character in the multiple frames of images based on the human body detection results, face detection results and key point detection results; wherein the shooting status includes the motion status 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 status of all characters is valid.

[0022] In an embodiment provided in the first aspect, 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 character is the average coordinate point of the top of the head key point and the neck 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 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.

[0024] 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, 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.

[0025] In an embodiment provided in the first aspect, 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, 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.

[0026] In an embodiment 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 detected key points.

[0027] In an implementation 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.

[0028] In an implementation provided by 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.

[0029] In an embodiment 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.

[0030] In an embodiment provided in 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 key points of the top of the head and the key points of the neck, the shooting status of the person is invalid.

[0031] 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 includes 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.

[0032] 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.

[0033] 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.

[0034] In a fifth aspect, the present application provides a chip system comprising one or more interface circuits and one or more processors. The interface circuits and processors are interconnected via a circuit. The chip system can be applied to a terminal device comprising a communication module and a memory. The interface circuit is configured to receive a signal from the memory of the terminal device and send the received signal to the processor, the signal comprising a computer instruction stored in the memory. When the processor executes the computer instruction, the terminal device can perform the method of the first aspect and any possible design thereof.

[0035] 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

[0036] FIG1 is a schematic diagram of an interface provided in an embodiment of the present application;

[0037] FIG2 is another schematic diagram of an interface provided in an embodiment of the present application;

[0038] FIG3 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0039] FIG4 is a schematic diagram of a set of interfaces provided in an embodiment of the present application;

[0040] FIG5 is a schematic diagram of a set of interfaces provided in an embodiment of the present application;

[0041] FIG6 is a schematic diagram of a set of interfaces provided in an embodiment of the present application;

[0042] FIG7A is a flowchart diagram 1 of an image capture method provided in an embodiment of the present application;

[0043] FIG7B is a schematic diagram of another interface provided in an embodiment of the present application;

[0044] FIG8 is a second flow chart of an image capture method provided in an embodiment of the present application;

[0045] FIG9 is a schematic diagram of a portrait provided in an embodiment of the present application;

[0046] FIG10 is another schematic diagram of a portrait provided in an embodiment of the present application;

[0047] FIG11 is a schematic diagram of another portrait provided in an embodiment of the present application;

[0048] FIG12 is a schematic diagram of another portrait provided in an embodiment of the present application;

[0049] FIG13A is a third flow chart of an image capture method provided in an embodiment of the present application;

[0050] FIG13B shows reference positions for the golden triangle rule, the rule of thirds rule, the diagonal rule, and the center rule;

[0051] FIG14 is a fourth flow chart of an image capture method provided in an embodiment of the present application;

[0052] FIG15 is a schematic diagram of generating a second-order tree structure according to an embodiment of the present application;

[0053] FIG16 is a schematic diagram of a minimum spanning tree provided in an embodiment of the present application;

[0054] FIG17 is a schematic diagram of another embodiment of the present application for generating a second-order tree structure;

[0055] FIG18 is a fifth flow chart of an image capture method provided in an embodiment of the present application;

[0056] FIG19 is a sixth flow chart of an image capture method provided in an embodiment of the present application;

[0057] FIG20 is a schematic structural diagram of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0058] 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 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 contrary indication 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: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0059] References to "one embodiment" or "some embodiments" etc. described in this specification mean that the specific features, structures or characteristics described in conjunction with the embodiment are included in one or more embodiments of the present application. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing 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 another way. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in another way. The term "connected" includes direct and indirect connections, unless otherwise stated. "First" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated.

[0060] In the embodiments of this application, words such as "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 this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplarily" or "for example" is intended to present the relevant concepts in a concrete manner.

[0061] To enable users to obtain high-quality images, related technologies provide a solution that uses basic composition schemes to guide users in taking photos. Specifically, the electronic device can detect the face or body of a person in the picture, obtain the face position or body position, and trigger the photo operation when the face position or body position matches a pre-defined photo template. However, this solution has at least the following two problems:

[0062] First, the distribution of a person's weight within the frame is not considered, resulting in imbalanced images. For example, as shown in Figure 1, the electronic device detects a person in the frame and takes a picture when it determines that the person's position matches a predefined capture template. However, because the distribution of the person's weight within the frame is not considered, the image does not include the person's head, resulting in imbalance and poor image quality.

[0063] Secondly, the positional relationship between multiple people in a multi-person shooting scene is not taken into account, which may result in the unreasonable position of some people in the captured image. For example, as shown in Figure 2, the electronic device performs face detection on two people in the picture (person a and person b). When it detects that one of the people (for example, person a) meets the pre-defined photo template, the photo is taken. However, because 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.

[0064] The present invention provides an image capture method that can, after acquiring multiple frames of images, determine the shooting status of each person in the multiple frames and ultimately retain the legal images in the multiple frames. A legal image is an image in which the shooting status of all the people is valid.

[0065] Among them, the shooting status refers to the status of the person in the picture, including but not limited to the person's movement state, the person's portrait type, the key points of the person, the area occupied by the person in the picture, the person's position in the picture, and whether the person has his eyes open or is smiling.

[0066] For example, the motion states of a person include, but are not limited to, walking, running, jumping, playing badminton, swimming, and being still. The types of person portraits include facial close-up, bust, 30 / 90% portrait, full-body portrait, and partial close-up, which are used to roughly represent the approximate truncation state of the person's body parts in the picture.

[0067] Electronic devices can pre-set multiple invalid states. If the person's shooting state is not in 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 body (such as the head, hands, feet) is 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 smiles; 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.

[0068] It can be seen that by determining the shooting status of each character, it is possible to avoid retaining images with unbalanced images and images containing some images that are obviously not aesthetically pleasing (such as missing arms and legs), thereby achieving the effect of ensuring image quality.

[0069] Furthermore, the electronic device may also evaluate the composition quality of the multiple frames of images and retain one or more frames of images with higher composition quality among the multiple frames of images.

[0070] In this embodiment, the composition quality of an image can be evaluated based on at least three aspects: basic composition, social relationships in multi-person scenes, and the placement of characters in multi-person scenes. Basic composition can be used to determine whether the character's position matches common photographic composition rules. If the character's position matches common photographic composition methods, the image's basic composition can be considered to conform to conventional aesthetic standards and have high composition quality.

[0071] Social relationships in multi-person scenes can be used to measure the closeness of relationships between multiple people in an image. If the relationships between the characters are relatively close, it can be assumed that the image is likely to have rich emotions, be able to emotionally impact the viewer, and have high composition quality.

[0072] The position arrangement of people in multi-person scenes can be used to measure whether the arrangement of multiple people in an image with three or more people is dispersed. If the arrangement of multiple people is not dispersed, the position arrangement of multiple people in the image is considered to be reasonable and the composition quality is high.

[0073] Among them, compared with the method of simply matching the photo template by identifying the human body position / face position, this application does not need to set the photo template in advance. Instead, after capturing multiple frames of images, it evaluates the image composition quality from multiple dimensions 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, and help users obtain high-quality images.

[0074] It should be noted that the image capture method provided in the embodiment of the present application can be applied to scenarios where a camera application is used in an electronic device, and in this scenario, image frames with high composition quality can be captured.

[0075] Illustratively, 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 a photo / records, and one or more frames of images with high composition quality can be saved.

[0076] As another example, 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 from multiple frames of images included in a video stream during the process of recording a video by an electronic device.

[0077] Hereinafter, the image capture method provided in the embodiment of the present application will be described mainly by taking the image preview process before taking a photo / recording as an example.

[0078] 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, as well as 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, an in-vehicle 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.

[0079] Figure 3 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. As shown in Figure 3, 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 194, and a subscriber identification module (SIM) card interface 195, etc.

[0080] 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.

[0081] It should 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, or may combine or separate certain components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0082] 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 processing unit (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). The different processing units may be independent devices or integrated into one or more processors.

[0083] The controller can be the nerve center and command center of the electronic device. The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.

[0084] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.

[0085] In some embodiments, the processor 110 may include one or more interfaces. The interfaces 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.

[0086] It is understood that the interface connection relationship between the modules illustrated in this embodiment is only for illustrative purposes and does not constitute a structural limitation on the electronic device. In other embodiments, the electronic device may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.

[0087] 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 charging the battery 142, the charging management module 140 can also power the electronic device through the power management module 141.

[0088] 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 provides power to the processor 110, the internal memory 121, the external memory, the display 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 provided in the same device.

[0089] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, a modem processor, and a baseband processor. In some embodiments, antenna 1 and mobile communication module 150 of the electronic device are coupled, and antenna 2 and wireless communication module 160 are coupled, so that the electronic device can communicate with the network and other devices through wireless communication technology.

[0090] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in an electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.

[0091] Mobile communication module 150 can provide wireless communication solutions for electronic devices, including 2G / 3G / 4G / 5G. It can include at least one filter, switch, power amplifier, and low-noise amplifier (LNA). Mobile communication module 150 receives electromagnetic waves from antenna 1, filters and amplifies the received electromagnetic waves, and transmits them to a modem processor for demodulation.

[0092] The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0093] 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), near field communication technology (NFC), infrared technology (IR), etc.

[0094] Wireless communication module 160 can be one or more devices that integrate at least one communication processing module. Wireless communication module 160 receives electromagnetic waves via antenna 2, frequency-modulates and filters the electromagnetic wave signals, and transmits the processed signals to processor 110. Wireless communication module 160 can also receive signals to be transmitted from processor 110, frequency-modulate and amplify them, and then convert them into electromagnetic waves for radiation via antenna 2.

[0095] The electronic device implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.

[0096] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel.

[0097] The electronic device can implement a camera function using an ISP, camera 193, a video codec, a GPU, a display 194, and an application processor. The ISP processes data fed back by camera 193. Camera 193 is used to capture still images or video. In some embodiments, the electronic device may include one or N cameras 193, where N is a positive integer greater than 1.

[0098] 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 via the external memory interface 120 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.

[0099] The internal memory 121 can be used to store computer executable program code, which includes 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 can execute instructions stored in the internal memory 121, and the internal memory 121 can include a program storage area and a data storage area.

[0100] The program storage area may store an operating system, at least one application required for a 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.

[0101] The electronic device can implement audio functions through the audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor, etc. For example, music playback, recording, etc. Buttons 190 include a power button, volume button, etc. Button 190 can be a mechanical button. It can also be a touch button. Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts or for touch vibration feedback. Indicator 192 can be an indicator light that can be used to indicate charging status, power changes, messages, missed calls, notifications, etc. SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and disconnected from the electronic device by inserting or removing it from the SIM card interface 195. The electronic device can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc.

[0102] The image capture method provided by this application will be described in detail below with reference to the accompanying drawings.

[0103] 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.

[0104] In an optional embodiment, the camera application has an automatic capture function (also known as "highlight capture" or "smart capture"). This automatic capture function means that when the electronic device intelligently recognizes a specific scene, such as a person smiling, jumping, running, or a pet, it can actively capture the high-quality image and retain the legal image with high composition quality. In other words, when the automatic capture function is enabled, the electronic device can actively capture multiple frames of images and retain the legal image with high composition quality among the multiple frames.

[0105] For example, the electronic device may be a mobile phone, and the process of enabling the automatic snapshot function may be as shown in FIG. 4 and FIG. 5 .

[0106] As shown in FIG4(a), the mobile phone may display interface 401 (also referred to as the main interface, desktop, or Home screen). Interface 401 includes multiple application icons, such as a camera application icon 401a and a settings application icon. If a user wishes to launch the camera application, they may click on the camera application icon 401a. The mobile phone may receive a user click on the camera application icon 401a. In response, the mobile phone launches the camera application and displays interface 402, as shown in FIG4(b). Interface 402 is a shooting preview interface, used to display images captured by the camera in real time. As shown in FIG4(b), interface 402 includes a settings button 402a and a photo button. The mobile phone may receive a user click on the settings button 402a. In response, the mobile phone may display interface 403, as shown in FIG5(a). Interface 403 includes multiple setting options, such as photo ratio, smart photo 403a, and filter recommendations. In response to the user's click on smart photo 403a, the mobile phone may display interface 404, as shown in FIG5(b). Interface 404 includes options such as voice-activated photography, gesture photography, smile capture, and automatic capture 404a. Furthermore, the automatic capture 404a option includes a switch button 404b and a prompt message 404c. The user can turn the automatic capture function on or off by clicking the switch button 404b. The prompt message 404c specifically describes the automatic capture function, for example, "When automatic capture is turned on, the system automatically captures moments such as people smiling, jumping, running, and cats and dogs."

[0107] In an optional implementation, the electronic device may also store legal images with high composition quality in a gallery, so that the user can view the captured images from the gallery.

[0108] For example, as shown in FIG6(a), an electronic device (e.g., a mobile phone) may display interface 601, which is a capture preview interface for displaying images captured by a camera in real time. Interface 601 also includes thumbnail 601a and icon 601b. Thumbnail 601a is a thumbnail of the most recent frame stored by the phone. Icon 601b indicates that the automatic capture function is enabled. The phone may receive a user's operation on icon 601b. In response to this operation, the phone may display interface 404 shown in FIG5(b) for configuring the automatic capture function. Furthermore, as shown in FIG6(b), if the phone captures a legitimate image with high-quality composition while displaying interface 601, it may store the image in the gallery and display thumbnail 601c, which is a thumbnail of the image just captured and stored in the gallery. If the user wishes to view the image just saved by the electronic device, they may click on thumbnail 601c. The mobile phone may receive a user's operation on the thumbnail 601 c , and in response to the operation, the mobile phone may display an image corresponding to the thumbnail 601 c .

[0109] 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.

[0110] To more clearly illustrate the process of image quality assessment by an electronic device, the following, with reference to the accompanying figures, illustrates the process by which the electronic device determines the shooting status of all figures in an image, as well as the process by which the electronic device determines the image's composition quality. It should be noted that the image can be any frame of preview stream image data captured in real time by the camera, and this is not a specific limitation.

[0111] As previously explained, the shooting state refers to the state of a person in the frame, including but not limited to the person's motion, their truncation within the frame, their center of mass, their area within the frame, and whether they have their eyes open or are smiling. The following describes in detail the process by which electronic devices determine a person's truncation within the frame.

[0112] FIG7A shows a flow chart of an image capture method provided in an embodiment of the present application. It specifically illustrates the process of an electronic device determining the truncation status of an image character in a picture. As shown in FIG7A , the image capture method includes:

[0113] S710, acquiring an image.

[0114] 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 frame of the multiple frames of images.

[0115] 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.

[0116] 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.

[0117] 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 has eyes open, whether it is smiling, etc. The face detection results may include the position of the face frame, whether the face has eyes open, 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, which 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.

[0118] S730: Determine the total number of people in the image based on the human body detection results and the face detection results.

[0119] In an optional embodiment, the electronic device may match all face frames with all human frames. The purpose of matching human frames with face frames is to determine whether the face frames and human frames belong to the same person. It is understood that if the face frames and human frames match, it can be determined that the face frames and human frames belong to the same person; if the face frames and human frames do not match, it can be determined that the face frames and human frames do not belong to the same person.

[0120] For example, the electronic device may extract feature points from each body frame and facial frame and perform similarity matching based on the feature points to determine matching facial and body frames. In another example, the electronic device may input the facial and body frames into a matching model to determine the confidence level of the match between the body and facial frames. When the confidence level of the match between the body and facial frames exceeds a preset threshold, the body and facial frames are considered matched.

[0121] Among them, the number of people N in the image is the sum of the number of body frames with matching face frames (or the number of face frames with matching body frames), the number of face frames without matching body frames, and the number of body frames without matching face frames.

[0122] For example, FIG7B shows an image. The image includes face frame a, face frame b, body frame c, body frame d, and body frame e. Face frame a matches body frame c, face frame b matches body frame d, and body frame e does not have a matching face frame. Therefore, the number of body frames with matching face frames in the image is 2, the number of face frames without matching face frames is 0, and the number of body frames without matching face frames is 1. Therefore, it can be determined that the image includes three people, i.e., the total number of people is 3.

[0123] S740: Determine whether the number of people currently processed is less than the total number of people.

[0124] 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.

[0125] S750: Determine the portrait type and centroid position based on the key point detection result.

[0126] It is understood that the electronic device can determine the portrait type and the position of the person in the picture based on the key point detection results. In this embodiment, considering that the person has a certain outline, the position of the person in the picture is represented by the position of the person's center of mass. In other words, the electronic device can determine the portrait type and the position of the person's center of mass based on the key point detection results.

[0127] Figure 8 shows a flow chart of the electronic device determining the portrait type and center of mass position of a person based on the key point detection results. 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.

[0128] As shown in Figure 8, when the key point detection results only include 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 that the center of mass position of the person is the average coordinate point of the key point of the top of the head and the key point of the neck. Exemplarily, as shown in Figure 9, the electronic device performs key point detection on the image to obtain the key point A of the top of the head and the key point B of the neck, where the coordinates of the key point A of the top of the head are (x1, y1) and the coordinates of the key point B of the neck are (x2, y2). The electronic device can then determine that the portrait type of the image is a close-up of the face, and the center of mass position of the person is the average coordinate point R1 of the key point A of the top of the head and the key point B of the neck, and the coordinates of the average coordinate point R1 are ((x1+x2) / 2, (y1+y2) / 2).

[0129] 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.

[0130] Considering that in some bust portraits, the user's arms and wrists may also be captured, in another optional embodiment, when the key point detection results include the top of the head key points, the neck key points, and the shoulder key points, the key point detection results may further include the arm key points and / or the wrist key points. The electronic device can also determine that the portrait type is a bust portrait and determine the center of mass of the person as the average coordinate point of the neck key points and the shoulder key points.

[0131] For example, as shown in FIG10 , the electronic device performs key point detection on the image to obtain 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). The electronic device can then determine that the portrait type of the image is a bust portrait, 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:

[0132] Among them, N is the number of key points, which is 4.

[0133] In an optional embodiment, 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 70 / 90 portrait, and determine the center of mass of the person as the average coordinate point of the hip joint key points, arm key points, shoulder key points, neck key points, and top of the head key points. The algorithm for obtaining this average coordinate point is similar to the method for obtaining the average coordinate point R2 described above, except that N = 5, i.e., i∈[1,5], which will not be repeated here.

[0134] Considering that in some 70% / 90% portraits, the user's wrists and knees may also be in the frame, in another optional embodiment, 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 the portrait type as a 70% / 90% portrait, and determine the center of mass of the person as the average coordinate point of the key points of the top of the head, neck, shoulders, hip joints, and arms.

[0135] For example, as shown in FIG11 , the electronic device performs key point detection on the image and can 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 / ninth-point 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.

[0136] 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 that the portrait type is a full-body portrait, and determine the center of mass position of the person as the average coordinate point of the top of the head key point, neck key point, shoulder key point, hip joint key point, and arm key point.

[0137] Considering some full-body portraits, for example, where the user is crouching or wearing loose clothing, the shoulders, hips, arms, wrists, or knees cannot be detected. Therefore, even if the key point detection results only include key points on the top of the head and ankles, the electronic device can still determine the portrait type as a full-body portrait. In this case, the electronic device can use the center point of the person's body frame as the person's center of mass. The center point of the body frame refers to the intersection of the two diagonals of the body frame.

[0138] For example, as shown in Figure 12, the electronic device performs key point detection on the image and obtains 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.

[0139] In an optional embodiment, if the key point detection results do not include key points on the top of the head and shoulders, the electronic device determines the portrait type as a partial close-up and determines the center of mass of the person as the average coordinates of all detected key points. For example, if the key point detection results only include the arms, the electronic device may determine the portrait type as a close-up of the arms, and the center of mass is the average coordinates of the arms.

[0140] S760: Determine the truncation status of the person based on the human body detection result, key point detection, and portrait type.

[0141] It can be understood that the portrait type can roughly represent the approximate truncation state of the person's body parts in the picture. For example, if the portrait type is close-up, it means that the picture only includes the person's head, and the body parts below the head are truncated. If the portrait type is bust, it means that the picture includes the person's upper body, and the body parts below the waist are truncated. If the portrait type is 30 / 90%, it means that the picture includes the person's calves / ankles and above, and the feet are truncated. If the portrait type is full-body, it means that the picture includes the person's entire body.

[0142] Specifically, the electronic device can confirm the truncation status of specific human body parts (such as limbs or head) based on key point detection results. For example, if the key point detection results do not include key points on the top of the head or neck, it can be determined that the person's head is truncated in the image. For another example, if the key point detection results do not include elbows or wrists, it can be determined that the person's hands are truncated in the image.

[0143] S770, the number of characters currently processed is increased by 1.

[0144] In this way, when an image includes N persons, the electronic device can determine the portrait types and centroid positions of the N persons.

[0145] In an optional embodiment, 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 has been pre-trained to convergence and can be used to identify 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.

[0146] In an optional embodiment, the electronic device may further determine the area percentage of each person based on the body detection results. The area percentage of a person is specifically the percentage of the person's area in the image, which may be the ratio of the person's area to the image area. In an optional embodiment, the person's area is the area of ​​the body frame corresponding to the person.

[0147] After the electronic device determines the shooting status of all people in the image, it can confirm whether the image is a legal image.

[0148] In an optional embodiment, an image may include a subject person and valid persons, and the electronic device may perform validity determinations on each of the subject person and valid persons. The subject person primarily refers to the main person in the image, or the protagonist. Valid persons are persons in the image whose importance is less than that of the main person, such as passersby.

[0149] As shown in FIG13A , the electronic device can sequentially determine whether each person meets the valid person criteria. If so, the person is stored in the valid person set. If the person also meets the subject person criteria, the person is stored in the subject person set. After determining whether all people in the image are subject people or valid people, the electronic device can perform validity checks on the people in the valid person set and the people in the subject person set separately.

[0150] In an optional embodiment, the electronic device may divide characters into valid characters and main characters based on the area ratio of the characters and the position of the center of mass 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. That is to say, 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.

[0151] In this embodiment, the electronic device can set multiple invalid states for the valid characters and the main character respectively. Among them, the valid characters can have limbs cut off or inadequate expressions compared to the main character.

[0152] 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 limb truncation; when the character is throwing or playing badminton, the portrait type is not full-body or half-body, or there is 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 stationary state, and does not open his eyes or smile, or there is face truncation; the character is in a stationary state, and the area is too large when no face is detected; the character is in a stationary 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.

[0153] 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.

[0154] For a valid person, multiple invalid states may include: 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, the shooting state of the valid person can be determined to be valid.

[0155] It should be noted that the above-mentioned invalid states are only examples, and more can be set according to actual needs.

[0156] In an optional implementation, the image is determined to be legal when the shooting statuses of all valid persons and all subject persons are valid.

[0157] In an optional embodiment, the electronic device may not distinguish between valid characters and subject characters, but may directly determine whether the shooting status of all characters is valid. If the shooting status of all characters is valid, the image is deemed legal. The principle for determining whether the shooting status of each character is valid is similar to the principle for determining whether the shooting status of the subject character / valid character is valid, and will not be further elaborated here.

[0158] Electronic devices can also evaluate the composition quality of an image. This can be assessed based on at least three aspects: basic composition, social relationships in multi-person scenes, and the placement of people in multi-person scenes. Each of these aspects is described below.

[0159] 1. Basic composition

[0160] Basic composition refers to the layout and structure of an image, specifically the positioning of characters within it. Common photography composition rules include, but are not limited to, the golden triangle, the rule of thirds, the rule of diagonals, and the rule of center. Different composition rules may have different marking points or guiding lines to aid composition.

[0161] As shown in Figure 13B, the reference positions for the golden triangle, rule of thirds, diagonal rule, and central rule are shown. If a person is near any of the four points of interest, the image can be considered to be relatively consistent with the golden triangle. If a person is near any of the three-point lines, the image can be considered to be relatively consistent with the rule of thirds. If a person is near any of the diagonals, the image can be considered to be relatively consistent with the central rule. If a person is near the center point, the image can be considered to be relatively consistent with the central rule.

[0162] In this embodiment, the electronic device can determine a distance parameter based on the distance from the target person's center of mass to the reference position, and use this distance parameter to measure the degree of match between the image and the preset composition rule. Different composition rules correspond to different reference positions and, therefore, different distance parameters. It should be noted that the target person can be any person in the image or the main subject of the image.

[0163] 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 between an image and different composition rules when the image includes only one person is first explained.

[0164] For the golden triangle composition rule, the reference positions are four points of interest. The electronic device can calculate the distances between the center of mass position and the four points of interest and use the minimum of the four distances as a first distance parameter to indicate the degree of match between the image and the golden triangle composition rule. The smaller the first distance parameter, the higher the degree of match between the image and the golden triangle composition rule.

[0165] Among them, the first distance parameter satisfies:

[0166] in, is the first distance parameter, dis(i) is the distance from the centroid to the i-th point of interest, i = 1, 2, 3, 4.

[0167] Among them, the distance from the center of mass position to any point of interest satisfies:

[0168] Among them, d(P ix , P iy ) is the coordinate of the i-th interest point.

[0169] For the rule of thirds, the reference positions are the four thirds lines. The electronic device can calculate the distances between the center of mass and the four thirds lines and use the minimum of the four distances as a second distance parameter to indicate the degree of alignment of the image with the rule of thirds. The smaller the second distance parameter, the more aligned the image is with the rule of thirds.

[0170] Among them, the second distance parameter satisfies the formula:

[0171] in, is the second distance parameter, d(mass, Li) refers to the distance from the center of mass to the i-th third line, i = 1, 2, 3, 4.

[0172] 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:

[0173] For the diagonal rule, the reference positions are the two diagonals. The electronic device calculates the distances from the center of mass to the two diagonals and uses the minimum of the two distances as a third distance parameter to indicate the degree of alignment of the image with the diagonal rule. The smaller the third distance parameter, the more aligned the image is with the diagonal rule.

[0174] Among them, the third distance parameter satisfies the formula:

[0175] in, 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.

[0176] For the central composition rule, the reference position is the image center. The electronic device can calculate the distance from the center of mass to the image center and use this distance as a fourth distance parameter to indicate the degree of alignment between the image and the central composition rule. A smaller fourth distance parameter indicates a higher degree of alignment between the image and the central composition rule, and a more even distribution of the person throughout the image.

[0177] Among them, the fourth distance parameter satisfies:

[0178] in, is the fourth distance parameter, (C x , C y ) are the coordinates of the center point.

[0179] When an image includes N people, the degree to which the image matches different composition rules is related to the area ratio of each person and the distance between the center of mass of the person and each marker point or guide line.

[0180] 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. The obtained result is used as the first distance parameter to represent the degree of match between the image and the golden triangle composition rule. Specifically, the calculation formula can be as follows:

[0181] Where Sp is the degree of matching between the image and the golden triangle composition rule when the image includes N people; w jis the area proportion of the jth character, j∈[1,N], P j is the center of mass position of the jth person, P i P For the i-th interest point, i∈[1,4], massDistance AllPoint (j) is the minimum distance from the center of mass of the j-th person to the four points of interest.

[0182] 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 the N characters to the four thirds lines. Then, the N minimum distances are weighted averaged using the area ratio of the characters as the weight. The result is used as the second distance parameter to represent the degree of match between the image and the rule of thirds. Specifically, the calculation formula can be as follows:

[0183] Among them, S T w is the degree of matching of the image with the rule of thirds when N people are included in the image; j is the area proportion of the jth character, 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 j-th person to the four thirds lines.

[0184] 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 the N characters to the two diagonals. Then, the N minimum distances are weighted averaged using the character's area ratio as the weight. The result is used as the third distance parameter to represent the degree of match between the image and the diagonal rule. Specifically, the calculation formula can be as follows:

[0185] Among them, S D w is the degree of matching between the image and the diagonal rule when there are N people in the image; j is the area proportion of the jth character, j∈[1,N], P j is the center of mass position of the jth person, P i D is the i-th diagonal line, i∈[1,2], massDistanceDiagonaLine(j) is the minimum distance from the center of mass of the j-th person to the two diagonals.

[0186] For the central composition rule, the electronic device can calculate the area ratio of 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. The result is used as the fourth distance parameter to represent the degree of match between the image and the central composition rule. Specifically, the calculation formula can be as follows:

[0187] Among them, S C w is the degree of matching between the image and the central composition rule when there are N characters in the image; j is the area proportion of the jth character, j∈[1,N], P j is the center of mass position of the jth person, P C As the center point, massDistance Center (j) is the distance from the center of mass of the j-th person to the center point.

[0188] 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 degree of matching between the image and the composition rule is, that is, the higher the composition quality of the image is.

[0189] 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 different methods respectively, which will not be repeated here.

[0190] 2. Social Relationships in Multi-Person Scenarios

[0191] When an image includes two or more target persons, the electronic device can also evaluate the social relationship characteristics of the image. Social relationship characteristics can implicitly express the relationship between the target persons in the image, such as whether the relationship between the persons is close, which may emotionally influence the viewer's preference.

[0192] 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.

[0193] Specifically, the electronic device can determine the facial position of each target person in the image and determine the image's intimacy parameter based on the multiple facial positions. The target person can be each person in the image or the main subject in the image. The facial position can be the center point of the face frame or the center of mass of the person's head. The center of mass of the person's head refers to the average coordinates of the key points on the top of the head and the neck. The specific algorithm is described above and will not be repeated here.

[0194] FIG14 shows a flow chart of an image capture method provided by an embodiment of the present application. It specifically illustrates the process of an electronic device determining an image intimacy parameter. As shown in FIG14 , the image capture method provided by an embodiment of the present application includes:

[0195] 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.

[0196] For example, the image shown in (a) of FIG15 includes five face frames, whose center points 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, the Euclidean distance between AC as the weight of the AC edge, the Euclidean distance between AD as the weight of the AD edge, the Euclidean distance between AE as the weight of the AE edge, the Euclidean distance between BC as the weight of the BC edge, the Euclidean distance between BD as the weight of the BD edge, the Euclidean distance between BE as the weight of the BE edge, the Euclidean distance between CD as the weight of the CD edge, the Euclidean distance between CE as the weight of the CE edge, and the Euclidean distance between DE as the weight of the DE edge. The second-order tree structure constructed based on A, B, C, D, and E can be shown in (b) of FIG15.

[0197] S1402: Construct a minimum spanning tree of a second-order tree structure, where the minimum spanning tree includes N-1 edges.

[0198] The minimum spanning tree includes all nodes in the second-order tree structure and includes the minimum number of edges required to keep the graph connected.

[0199] Electronic devices can use Prim's algorithm or Kruskal's algorithm to construct a minimum spanning tree. The Kruskal algorithm sorts all edges in a connected network (i.e., a second-order tree structure) in ascending order by weight, starting with the edge with the smallest weight. As long as this edge does not form a loop with an already selected edge, it is selected to form the minimum spanning tree. For a connected network with N vertices, N-1 edges that meet the criteria are selected, and the spanning tree formed by these edges is the minimum spanning tree.

[0200] For example, the electronic device sorts all edges in the second-order tree structure shown in (b) of FIG. 15 in ascending order according to weight values, and Table 1 can be obtained:

[0201] Table 1

[0202] The smallest weights are those of edge BC and edge CD, both 3. Assuming the electronic device starts selecting from edge BC, since no edge has yet been selected to form a minimum spanning tree, and since edge BC itself does not form a loop, edge BC can form a minimum spanning tree. Since edge CD does not form a loop with the selected edge BC, it can form a minimum spanning tree. Since edge DE does not form a loop with the selected edge BC or CD, it can form a minimum spanning tree. Since edge EA does not form a loop with the selected edge BC, CD, and edge DE, it can form a minimum spanning tree. However, since edge DA forms a loop with the selected edge, it cannot form a minimum spanning tree. This results in the minimum spanning tree shown in Figure 16.

[0203] 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.

[0204] For example, as shown in Figure 17, the electronic device first determines the edge with the smallest weight from AE, AD, AC, and AB, which is AE. Next, 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.

[0205] S1403: Determine the average value of the weights of the N-1 edges as the intimacy parameter.

[0206] The specific calculation formula is:

[0207] Among them, Face Closeness is the intimacy parameter, and N is the total number of faces.

[0208] Understandably, Face Closeness The smaller it is, the more compact the faces in the picture are, and the closer the relationship between the characters is, the richer the emotions contained in the image, and therefore the higher the quality of the composition.

[0209] 3. Character Position Arrangement in Multiplayer Scenes

[0210] When an image includes three or more target persons, the electronic device can determine the image compactness parameter based on the center of mass positions of the target persons 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.

[0211] FIG18 is a flowchart of an image capture method provided by an embodiment of the present application. It specifically illustrates the process of an electronic device determining an image intimacy parameter. As shown in FIG18 , the image capture method provided by an embodiment of the present application includes:

[0212] S1801: Normalize the N centroid positions.

[0213] In this embodiment, 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 character. The center of mass position after normalization satisfies:

[0214] 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.

[0215] 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.

[0216] 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.

[0217] 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.

[0218] 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.

[0219] Specifically, the electronic device can compare the composition indicators of any two frames of images in the multiple frames, eliminate the frame image with lower composition quality in the any two frames of images, and then continue to compare the composition indicators of any two frames of images in the multiple frames after eliminating the frame image 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.

[0220] The comparison process is described below in detail by taking an electronic device comparing the composition indicators of a first image and a second image as an example.

[0221] 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.

[0222] 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 of the second image with the golden triangle composition rule, the second distance parameter b is used to characterize the degree of matching of the second image with the rule of thirds composition, the third distance parameter b is used to characterize the degree of matching of the second image with the diagonal rule, the fourth distance parameter b is used to characterize the degree of matching of the second image with 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.

[0223] 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.

[0224] In the case where the total number of people in both 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. If 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.

[0225] 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 degree of similarity between the first distance parameter a and the first distance parameter b. If the first difference is less than or equal to the first threshold, it indicates that the first image and the second image may use the same composition principle, and therefore are not comparable. If the first difference is greater than the first threshold, it indicates that the first image and the second image do not use the same composition principle, and therefore are comparable.

[0226] 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.

[0227] When the second difference is less than or equal to the second threshold, the electronic device may calculate the 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.

[0228] When the third difference is less than or equal to the third threshold, the electronic device may calculate the 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; 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.

[0229] 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 parameter of the two images, and can further determine the image quality based on parameters such as clarity and signal-to-noise ratio.

[0230] 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 parameter and the intimacy parameter of the two images.

[0231] First, the electronic device can compare the distance parameters of the two images. For details, see the previous section and are not 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 two images based on a closeness parameter.

[0232] 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. 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.

[0233] 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.

[0234] When the total number of persons in both images is greater than 2, the electronic device may compare the composition qualities of the two images by using a compactness parameter.

[0235] 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.

[0236] In an optional embodiment, 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 repeated here.

[0237] In an optional embodiment, after acquiring multiple frames of images, the electronic device may compare the composition indicators of the multiple frames of images and ultimately 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.

[0238] In an optional embodiment, as shown in FIG19 , after acquiring multiple image frames, the electronic device may first obtain the legitimacy detection results and composition indicators of the multiple image frames. The image frames are then compared pairwise. If one of the two image frames is legal and the other is illegal, the legal image may be determined to have a higher composition quality. If both image frames are legal or illegal, the image with higher composition quality is determined based on the composition indicators of the two images. The process of comparing the composition indicators of the two image frames is described above and will not be repeated here.

[0239] 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 image based on the shooting status of all objects and the composition quality of the image.

[0240] In another optional embodiment, for each frame of image, the electronic device may first identify the shooting status of all subjects in the image. Only when the shooting status of all subjects in the image is reasonable will the electronic device further evaluate the image's composition quality. This eliminates the need to evaluate the composition quality of images where some or all of the subjects have unreasonable shooting status, reducing computational complexity and enabling the electronic device to more quickly determine which images to retain from multiple frames.

[0241] To sum up, this application does not require pre-setting of photo templates. Instead, it evaluates the image composition quality from multiple dimensions after capturing multiple frames of images, and retains images with good basic composition, close character relationships, and reasonable personnel arrangement. The images obtained in this way can avoid the rigidity of photo templates, give users free play, and help users obtain high-quality images.

[0242] An embodiment of the present application further provides an electronic device, which may include a memory and one or more processors. The memory and processors are coupled. The memory is configured to store computer program code, which includes computer instructions. When the processor executes the computer instructions, the electronic device may perform the functions or steps performed by the mobile phone in the above-described method embodiment.

[0243] An embodiment of the present application also provides a chip system, as shown in Figure 20, 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 the memory of an electronic device). For another example, the interface circuit 2002 can be used to send signals to other devices (such as the 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 execute the various steps in the above embodiments. Of course, the chip system can also include other discrete devices, which is not specifically limited in the embodiment of the present application.

[0244] This embodiment also provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on an electronic device, the electronic device or server executes each function or step in the above method embodiment.

[0245] 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.

[0246] 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 to enable the chip to perform the various functions or steps performed by the mobile phone in the above method embodiment.

[0247] 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.

[0248] 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.

[0249] In the several embodiments provided in this 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 merely schematic. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, 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.

[0250] The units described as separate components may or may not be physically separate, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0251] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0252] 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 and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0253] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit the present application. Although the present application has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions 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; One or more frames of images with the highest composition quality among the multiple frames of images are saved; 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.

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 any one of claims 1 to 5, characterized in that: When the number of persons N≥2, the composition index includes the intimacy parameter, the character information includes the face positions of N target persons, and the composition index of the corresponding image is determined according to the character information of each frame of the image, including: 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.

7. The method according to claim 6, 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.

8. The method according to any one of claims 1 to 7, 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.

9. The method according to claim 8, 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.

10. The method according to claim 9, 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.

11. The method according to any one of claims 8 to 10, 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.

12. The method according to any one of claims 1 to 11, 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.

13. The method according to any one of claims 1 to 12, 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.

14. The method according to claim 13, 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.

15. The method according to claim 13, 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.

16. The method according to claim 13, 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.

17. The method according to claim 13, 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.

18. The method according to claim 13, 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.

19. The method according to any one of claims 13 to 18, 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.

20. The method according to any one of claims 13 to 18, 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.

21. The method according to any one of claims 13 to 18, 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.

22. The method according to any one of claims 13 to 18, 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.

23. 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-22.

24. 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 22.

Citation Information

Patent Citations

  • Image capturing method and electronic equipment

    CN117135441A

  • Intelligent shooting method and device based on intelligent composition and micro expression analysis

    CN107025437A

  • Guiding method and device for photography composition

    CN109196852A

  • Face image uploading method and device, electronic equipment and storage medium

    CN111160201A

  • Scoring method and device based on shooting composition, equipment and storage medium

    CN111432114A