Face brightness calculation method and device, medium and equipment

By calculating the brightness difference between the edge and central regions of a face image and adjusting the size of the region of interest, the problem of face brightness calculation error is solved, achieving higher accuracy and better shooting results.

CN115988310BActive Publication Date: 2025-12-23XIAN WINGTECH INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211687498.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-27
Publication Date
2025-12-23
Estimated Expiration
2042-12-27

AI Technical Summary

Technical Problem

In existing technologies, the face recognition bounding box cannot accurately adapt to different face shapes, sizes, and orientations during face brightness calculation. Non-face areas are misidentified as face areas, resulting in brightness calculation errors and increasing the difficulty of adjusting the effect.

Method used

By calculating the brightness difference between the edge and central regions of the region of interest, the size of the region of interest is adjusted to obtain more accurate facial brightness and adapt to different shooting scenarios.

Benefits of technology

It improves the accuracy of facial brightness statistics and achieves good shooting results under different conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115988310B_ABST
    Figure CN115988310B_ABST
Patent Text Reader

Abstract

The application relates to a face brightness calculation method, device, medium and equipment, the method comprises the following steps: acquiring a first region of interest in an image, the first region of interest comprising a face; determining a target brightness difference value between a central region and an edge region of the first region of interest; adjusting the size of the first region of interest according to the target brightness difference value to obtain a second region of interest; and determining the brightness of the second region of interest as the face brightness of the image. The brightness difference value between the edge region and the central region of the region of interest is calculated, the size of the region of interest is adjusted through the brightness difference value, the size of the face region is converged to an ideal size, the face brightness is calculated, the accuracy of face brightness statistics is improved, different shooting scenes are adapted to, and a good portrait shooting effect is realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of camera control, in particular to a face brightness calculation method and device, a medium and equipment. BACKGROUND

[0002] With the continuous popularization of camera technology, people use cameras to take pictures, shoot and share videos more and more frequently. At the same time, people have higher and higher requirements for the quality of taking pictures. In the image effect, AE plays an important role, which can automatically adjust the current image brightness according to the user's preference.

[0003] AE (Auto Exposure) refers to the camera automatically adjusting the exposure and gain according to the strength of external light to prevent overexposure or underexposure. Auto exposure is one of the most basic technologies for mobile phone photography.

[0004] In the prior art, when taking a photo with a face, due to the different shapes, sizes, orientations, etc. of different faces, the face statistical box may not accurately adapt to the size of the face when taking an image, that is, the non-face area of the face edge will be misjudged as a face area, and a certain size weight will be assigned for brightness statistics, resulting in a large error in the calculation result of the face brightness, wrong exposure, and finally the face brightness cannot reach the expected brightness, increasing the difficulty and workload of effect debugging. SUMMARY

[0005] To solve at least one of the technical problems in the background art, the present application provides a face brightness calculation method, device, medium and equipment.

[0006] The first aspect of the present application provides a face brightness calculation method, characterized in that the method comprises: acquiring a first region of interest in an image, wherein the first region of interest comprises a face; determining a target brightness difference value between a central region and an edge region of the first region of interest; adjusting the size of the first region of interest according to the target brightness difference value to obtain a second region of interest; and determining the brightness of the second region of interest as the face brightness of the image.

[0007] Optionally, the adjusting the first region of interest according to the brightness difference value to obtain a second region of interest comprises: determining a target reduction coefficient according to a preset corresponding relationship between a brightness difference value and a reduction coefficient and the target brightness difference value; generating the second region of interest by reducing the first region of interest by the target reduction coefficient; or, generating the second region of interest by reducing the first region of interest by a preset reduction coefficient.

[0008] Optionally, before the first region of interest is adjusted according to the target brightness difference and the second region of interest is obtained, the method further comprises: determining that the target brightness difference is greater than or equal to a preset threshold.

[0009] Optionally, the equal-ratio reduction of the first region of interest according to the target reduction coefficient or the preset reduction coefficient to generate the second region of interest comprises: equal-ratio reduction of the first region of interest according to the target reduction coefficient or the preset reduction coefficient to generate a third region of interest; obtaining a new brightness difference between a central region and an edge region of the third region of interest; when the new brightness difference is greater than or equal to the preset threshold, at least once equal-ratio reduction of the third region of interest according to the target reduction coefficient or the preset reduction coefficient to obtain a fourth region of interest, the brightness difference between the central region and the edge region of the fourth region of interest being less than the preset threshold, determining the fourth region of interest as the second region of interest; when the new brightness difference is less than the preset threshold, determining the third region of interest as the second region of interest.

[0010] Optionally, when the edge region comprises a plurality of regions, the brightness of the edge region is determined by calculating the brightness mean of all regions.

[0011] Optionally, the edge region comprises a corner region where a vertex of a target rectangular region is located, and the size of each corner region is a preset region size, the target rectangular region being any one of the first region of interest, the second region of interest, the third region of interest, and the fourth region of interest.

[0012] Optionally, the first region of interest is obtained by target detection based on deep learning on the image or directly based on the features of the image.

[0013] The second aspect of the present application provides a face brightness calculation device, the device comprising: a first obtaining module configured to obtain a first region of interest in an image, the first region of interest comprising a face; a second obtaining module configured to determine a target brightness difference between a central region and an edge region of the first region of interest; an adjusting module configured to adjust the size of the first region of interest according to the target brightness difference and obtain a second region of interest; and a calculation module configured to determine the brightness of the second region of interest as the face brightness of the image.

[0014] The third aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, the program being executed by a processor to implement the steps of the method of any one of the first aspect.

[0015] The fourth aspect of the present application provides an electronic device, characterized by comprising: a memory having a computer program stored thereon; and a processor configured to execute the computer program in the memory to implement the steps of the method of any one of the first aspect.

[0016] The face brightness calculation method adjusts the size of the region of interest through the brightness difference value, converges the size of the face region to an ideal size, and calculates the face brightness, thereby improving the accuracy of face brightness statistics, adapting to different state shooting scenes, and achieving a good portrait shooting effect.

[0017] Other features and advantages of the present application will be described in detail in the following specific embodiments. BRIEF DESCRIPTION OF DRAWINGS

[0018] The accompanying drawings are included to provide a further understanding of the present application, and constitute a part of the specification, and are used to explain the present application together with the following specific embodiments, but do not constitute a limitation on the present application. In the drawings:

[0019] Figure 1 is a schematic block diagram of an electronic device according to an exemplary embodiment;

[0020] Figure 2 is an implementation flowchart of a face brightness calculation method according to an exemplary embodiment;

[0021] Figure 3 is a schematic diagram of a central region and an edge region according to an exemplary embodiment;

[0022] Figure 4 is an implementation flowchart of another face brightness calculation method according to an exemplary embodiment;

[0023] Figure 5 is a schematic diagram of another central region and edge region according to an exemplary embodiment;

[0024] Figure 6 is a schematic block diagram of a face brightness calculation device according to an exemplary embodiment;

[0025] Figure 7 is a schematic block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0026] The specific embodiments of the present application are described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application.

[0027] It should be noted that all the actions of obtaining signals, information or data in this application are carried out in accordance with the corresponding data protection regulations and policies of the country where the corresponding device owner is authorized.

[0028] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to be limiting of this application.

[0029] In the following description, "some embodiments" are related to a subset of all possible embodiments, but it can be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.

[0030] It should be noted that the terms "first", "second", "third" in the embodiments of the present application are used to distinguish similar or different objects, and do not represent a specific order of the objects. It can be understood that "first", "second", "third" can be interchanged in a specific order or sequence as allowed, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0031] Before the embodiments of the present application are further described in detail, the terms and terms involved in the embodiments of the present application are explained, which are applicable to the following explanations.

[0032] In the prior art, the AE algorithm controls the brightness of the image by adjusting the exposure time and the sensitivity (ISO) of the image sensor (Sensor). First, the Sensor outputs an initial image, enters the AE statistics module to count the brightness of the current frame, and then compares the brightness of the current frame with the expected target brightness. If the brightness is insufficient, the exposure amount is increased, and if the brightness is too high, the exposure amount is reduced. The new target brightness and exposure parameter are calculated, the new exposure parameter is written into the Sensor, and the above process is repeated until the frame brightness converges to the expected brightness.

[0033] The AE algorithm requires that the image brightness can be quickly and accurately converged to the target brightness, and the AE brightness statistics module as an important part of the AE algorithm has a great influence on the accuracy of brightness statistics.

[0034] In the AE brightness statistics module, common ones are light measurement for face recognition frame, center light measurement and point light measurement, etc. The light measurement area has a certain weight distribution, and the center area usually has a larger weight. First, the entire light measurement area is divided into m x n same size areas, and each area is assigned a certain weight. The two-dimensional weight table usually has the highest weight in the center area. For example, different weights are set in areas at different distances from the face center, and the weight gradually decreases from the center to the periphery.

[0035] The prior art can accurately calculate the brightness of the face, but in actual portrait shooting, the edge area of the rectangular face recognition frame often contains part of the background area. However, the face statistics area is fixed during the shooting process, and cannot fully adapt to the size of the face. For example: for small face or side face shooting scenes, the edge of the face area may contain the background area, and the calculation of the face brightness may not get the ideal value. Moreover, the two-dimensional weight table is fixed, so the non-face area will also be assigned a certain weight, thereby affecting the calculation of the face brightness. The larger the background area contained in the face recognition frame, the greater the error in the calculation of the face brightness.

[0036] Therefore, the embodiments of the present application provide a face brightness calculation method, which calculates the brightness difference between the edge area and the central area in the region of interest, adjusts the size of the region of interest through the brightness difference, and converges the size of the face area to an ideal size for calculating the face brightness, thereby improving the accuracy of face brightness statistics, adapting to different shooting scenes, and achieving good portrait shooting effect.

[0037] The above method is applied to an electronic device with a camera function. The electronic device can be various types of devices with information processing capability during implementation. For example, the electronic device can include a personal computer, a notebook computer, a palm computer, or a server, etc. The electronic device can also be a mobile terminal, such as a mobile phone, a vehicle-mounted computer, a tablet computer, a camera, or a digital camera, etc. The functions realized by the method can be realized by calling program code by the processor in the electronic device. Of course, the program code can be saved in a computer storage medium. Therefore, the electronic device at least includes a processor and a storage medium.

[0038] Figure 1A schematic block diagram of an electronic device 100 having a camera function is provided for embodiments of the present application. In the process of the electronic device 100 capturing image information from a scene, a luminance computation is performed to obtain a luminance statistic, and the luminance statistic is used to dynamically and automatically adjust the current luminance of the scene to compensate for an exposure value (EV) selected by an auto exposure process within the electronic device. In this manner, if the luminance computation method within the electronic device results in a luminance statistic that indicates that the selected EV is too bright or too dark for the scene, the electronic device can set the auto exposure to select an EV that results in an image frame of the scene having a proper luminance.

[0039] As shown in Figure 1 The electronic device 100 includes a sensor array 110, an image capture controller 120, an image processor 130, an auto exposure compensation module 140, an image storage 150, and a luminance statistic device 160. The components included in the electronic device 100 illustrated in Figure 1 In the illustrated embodiment, the components are depicted as separate units. However, in other embodiments, any of the components can be integrated into a combined unit within common hardware and / or software.

[0040] The electronic device 100 can be a digital camera, such as a digital video camera, a digital still camera, or a combination of both. Furthermore, the electronic device 100 can be a stand-alone device (e.g., a stand-alone camera) or integrated into another device (e.g., a wireless communication device). As an example, the electronic device 100 can be integrated into a mobile phone to form a so-called camera phone or video phone. Preferably, the electronic device 100 is equipped to capture color images, black and white images, or both. In the present disclosure, the term "image," "imagery," "image information," or similar terms can refer to either video or still pictures interchangeably. Likewise, the term "frame" can refer to either a video frame or a still picture frame obtained by the electronic device 100.

[0041] The sensor array 110 obtains light information from a scene prior to capturing an image frame of the scene. The sensor array 110 includes a two-dimensional array of individual image sensors, such as arranged in rows and columns. The sensor array 110 can include, for example, a solid-state sensor array, such as a complementary metal-oxide-semiconductor (CMOS) sensor. The image sensors within the sensor array 110 are exposed to a scene to obtain light information from the scene and capture an image frame of the scene.

[0042] Image capture controller 120 uses the light information for preliminary vision front end (VFE) processing, such as auto focus and auto exposure. For example, image capture controller 120 performs auto exposure based on the light information from sensor array 110 to select an EV that achieves a current brightness of the scene. The selected EV defines an aperture size to control the amount of light from the scene that reaches sensor array 110 and a shutter speed to control the amount of time that sensor array 110 is exposed to light from the scene. For example, a typical default brightness is about 18% gray scale. When performing the default brightness, image capture controller 120 performs auto exposure to select an EV that produces an image frame of the scene having an average brightness value equal to about 18% gray scale.

[0043] In conventional electronic devices, sensor array 110 captures an image frame of each scene using the EV of the current brightness. However, the subject in a frame of an image can require a higher average brightness value, while other portions of the image frame can require a lower average brightness value. For example, when taking a portrait of a person in an outdoor scene, the environment includes a large amount of reflected light, which is bright, while the person's face is not sufficiently illuminated and reflects less light into sensor array 110, which is dim, the auto exposure process can overcompensate for this situation, thus causing the person's face to appear dim in the image frame. On the other hand, in some scenes where the person's face is directly facing a light source, the person's face has a high contrast level with the surrounding environment, the auto exposure process can also overcompensate for this situation, thus causing the person's face to appear completely saturated in the image frame. The user of the conventional electronic device must then perform manual auto exposure compensation to make the person's face in the image frame the appropriate brightness.

[0044] The method disclosed in this application enables electronic device 100 to optimize the brightness statistics in the process of taking a subject, such as a portrait, to improve the accuracy of the subject's brightness statistics and achieve a good shooting effect. The application calculates the brightness of the edge region and the brightness of the central region of the subject, then calculates the difference between the two to dynamically adjust the size of the face region, thus converging the size of the subject region to the ideal size, and then recalculating the brightness of the subject to adapt to different shooting scenarios.

[0045] Brightness statistics device 160 obtains light information from the scene at the current brightness. Brightness statistics device 160 identifies a region that includes the subject, divides the region into a plurality of sub-regions (e.g., 256 evenly divided regions), and calculates average brightness values in the plurality of sub-regions as the brightness value of the subject. The brightness value of each of the plurality of sub-regions can include a light brightness value ranging between 0 (i.e., black) and 255 (i.e., white). Brightness statistics device 160 then sends the brightness value of the subject to auto exposure compensation module 140.

[0046] The brightness statistics device 160 can be implemented as a stand-alone hardware component or as a programmable feature of a logic device (e.g., a microprocessor, DSP, or similar device). In some embodiments, the brightness statistics device 160 can be a programmable or integrated feature of a logic device implementing the image processor 130. In particular, the brightness statistics device 160 can be implemented as one or more software processes executed by such a logic device.

[0047] The auto exposure compensation module 140 determines whether the current brightness of the electronic device 100 is accurate for the scene based on the brightness values of the subject that are statistically determined by the brightness statistics device 160. The current brightness can not be accurate for the scene when the brightness values of the subject are too bright or too dark for the scene. If the current brightness is not accurate, the auto exposure compensation module 140 dynamically adjusts the current brightness to set an adjusted target brightness that is accurate for the scene.

[0048] In addition, the auto exposure compensation module 140 can build a hysteresis zone to generally stabilize the adjusted target brightness over a sequence of image scenes. If the adjusted target brightness is not accurate for a next scene, the auto exposure compensation module 140 can build a hysteresis zone to maintain the adjusted target brightness for the next scene to prevent fluctuations in the target brightness between a previous scene and the next scene. In other cases, the auto exposure compensation module 140 can build a hysteresis zone to minimally readjust the adjusted target brightness for the next scene to provide a gradual change in the target brightness between the previous scene and the next scene. This can be particularly useful when capturing a series of still images or capturing a video with the electronic device 100 to reduce brightness changes between frames.

[0049] The auto exposure compensation module 140 sends the adjusted target brightness to the image capture controller 120. The image capture controller 120 then performs auto exposure based on the adjusted target brightness to select an EV for the adjusted target brightness. The sensor array 110 can then capture an image frame of the scene using the EV for the adjusted target brightness. By using the EV, the sensor array 110 receives light from the scene with an aperture size defined by the selected EV and resets with a shutter speed defined by the selected EV. The sensor array 110 provides the captured image frame to the image processor 130 for processing and stores in the image storage device 150.

[0050] The image processor 130 receives the captured image frames from the sensor array 110 and performs any necessary processing of the image frames. The image processor 130 can, for example, perform filtering, cropping, demosaicing, compression, image enhancement, or other processing of the image frames captured by the sensor array 110. The image processor 130 can be implemented by a microprocessor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or any other equivalent discrete or integrated logic circuit. In some embodiments, the image processor 130 can form part of a CODEC that encodes the image frames according to a particular encoding technique or format, such as MPEG-2, MPEG-4, ITU H.263, ITU H.264, JPEG, or similar techniques or formats.

[0051] The image processor 130 stores the image frames in the image storage 150. The image processor 130 can store raw image frames, processed image frames, or encoded image frames in the image storage 150. If the image is accompanied by audio information, the audio can also be stored in the image storage 150, independently or in conjunction with the image frames. The image storage 150 can include any volatile or non-volatile memory or storage device, such as read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), or flash memory, or a magnetic data storage device or an optical data storage device, for example.

[0052] Figure 2 An implementation flowchart of a face brightness calculation method provided by an embodiment of the present application is shown in FIG. 2. The method can include the following steps 210 to 240. Figure 2

[0053] S210, a first region of interest in an image is acquired, and the first region of interest includes a face.

[0054] An image currently taken is acquired, a face in the image is detected, and a region including the face in the image is acquired as a region of interest. The region of interest acquired at this time is referred to as a first region of interest. The region of interest (ROI, Region of Interest) is also referred to as an exposure region in exposure. The brightness of different regions in an image is usually different, and if the average value of the brightness is obtained by performing brightness statistics on all bright and dark regions, the expected shooting effect cannot be achieved, and therefore a key exposure region is set. In the present application, the region of interest including the face is set as the exposure region.

[0055] Optionally, the first region of interest is obtained by target detection based on deep learning or directly based on the features of the image. ​

[0056] input the image into a preset target recognition deep learning model such as a neural network to obtain a face in the image and a region where each face is located.

[0057] Target detection is a task in machine learning. Detection gives an understanding of the foreground and background of a picture. We need to separate the target of interest from the background and determine the description (category and position) of the target. Therefore, the output of the detection model is a list. Each item in the list uses a data set to give the category and position of the detected target (usually represented by the coordinates of a rectangular detection box).

[0058] The target recognition deep learning model has been fine-tuned or trained to recognize faces and regions in images. For example, the fine-tuned or trained base model is used as the preset target recognition deep learning model in the present application.

[0059] Alternatively, the image can be detected directly based on the features of the image. The features can be grayscale, binary, edge, saliency, etc. For example, selective search can be used. The image is divided into many small blocks using the features of the image such as grayscale, binary, edge, color, saliency, etc. A strategy such as a greedy strategy is used to calculate the similarity of each two adjacent regions. Then, the most similar two blocks are merged each time. The image blocks generated each time include the merged image blocks, which are saved. In this way, different regions of the image are obtained. The regions are subjected to face judgment to obtain the region of interest. For example, a sliding window method can be used to determine the face features based on the features to obtain the window including the face as the region of interest.

[0060] The obtained region of interest is the smallest region including the face based on the features of the face in the image. However, this region is relatively small and not truly minimal. It is only the smallest for the region of interest search algorithm. It still includes a certain background region and has certain limitations.

[0061] S220, determining the target brightness difference between the central region and the edge region of the first region of interest.

[0062] After determining the region of interest in the image, the central region and the edge region of the region are determined. The central region is a certain region with the area center of the region as the range. The edge region refers to the edge zone of the shape of the region. The brightness of the central region and the edge region is calculated respectively. Then, the brightness difference between the two, i.e., the target brightness difference, is calculated. For example, Figure 3 as shown, Figure 3As shown in a schematic diagram of a central region and an edge region of the present application, a region of interest 310 is a square of 40mmx40mm, and the center of the area is a point (20mm, 20mm). A circle is drawn with the point as the center and a length of 2mm as the radius, and the circular region is taken as the central region 320. All regions within 2mm from the edge of the region of interest are taken as the edge region 330. The brightness of each pixel point in the central region is calculated, and the average brightness of all pixel points is taken to obtain the brightness value of the central region, such as 240. The brightness value of the edge region is obtained by the same method of calculating the brightness of the central region, such as 180. The target brightness difference value 60 is obtained by calculating the brightness difference between the two.

[0063] S230, adjusting the size of the first region of interest according to the target brightness difference value to obtain a second region of interest.

[0064] The target brightness difference value is used to adjust the region of interest to obtain the second region of interest after adjustment. The present application believes that the brightness of the face and the background in the region of interest is different due to different factors such as reflectivity and distance, and thus the face and the background in the region of interest can be distinguished by using this characteristic. When the target brightness difference value of the region of interest is large, it indicates that there is more background in the region of interest, and the size needs to be adjusted.

[0065] For example, when the target brightness difference value is 60, it indicates that the brightness difference between the two is large, and the region of interest needs to be reduced in size. The size of the region of interest is reduced by a certain multiple of the target brightness difference value, such as reducing the length of each side of the above-mentioned region of interest by 6mm. The size of the region of interest after reduction is 34mmx34mm, which is a square, and is the second region of interest.

[0066] S240, determining the brightness of the second region of interest as the brightness of the face in the image.

[0067] The brightness of the second region of interest is calculated, such as dividing the second region of interest into a specified number of regions, assigning different weights to each region from the center of the second region of interest, calculating the brightness of each region, multiplying the brightness of each region by the weight to obtain the weighted brightness, calculating the average of the weighted brightness of all regions, and taking the average of the weighted brightness as the brightness of the second region of interest. The brightness of the second region of interest is taken as the brightness of the face in the image.

[0068] The above-mentioned face brightness calculation method of the present application can also be used in scenes where the photographed object is not a face. The photographed object can be a specified object such as a vehicle, or a specified region, etc., and the present application does not limit this.

[0069] The face brightness calculation method is used for calculating the brightness difference of the edge region and the central region in the region of interest, adjusting the size of the region of interest through the brightness difference, converging the size of the face region to an ideal size, and calculating the face brightness, thereby improving the accuracy of face brightness statistics, adapting to different shooting scenes, and achieving a good portrait shooting effect.

[0070] Figure 4 Another implementation flowchart of a face brightness calculation method provided by an embodiment of the present application is shown in FIG. 5, which can include the following steps 210 to 240. Figure 4

[0071] S410, obtaining a first region of interest in an image, wherein the first region of interest includes a face.

[0072] Step 410 is similar to step 210 in the embodiment shown in FIG. 2, and thus is not described herein again. Figure 2

[0073] S420, determining a target brightness difference between a central region and an edge region of the first region of interest.

[0074] After obtaining the first region of interest, the central region and the edge region in the region of interest are determined.

[0075] Optionally, when the edge region includes a plurality of regions, the brightness of the edge region is determined by calculating the average brightness of all the regions.

[0076] The edge region can have a plurality of edge points, and a certain region near the edge points can be taken as the edge region.

[0077] In an embodiment of the present application, the edge region includes a corner region where a vertex of a target rectangular region is located, and the size of each corner region is a preset region size.

[0078] As shown in FIG. 5, Figure 5 Figure 5 Another schematic diagram of a central region and an edge region shown in the present application is shown in FIG. 6, Figure 5 wherein the central region 510 is a certain region of the same shape as the area center of the region of interest 500, and an example is that the region of interest is reduced by a certain multiple, for example, 20 times, to obtain a central region, and the edge region can take a certain region near the vertex of the region of interest, Figure 5 ​​​In this example, each vertex of the region of interest 500 is taken as a starting point, and the region of interest 500 is reduced in the edge length direction to obtain the edge regions 520, 530, 540, and 550. In some embodiments, one or more vertices can be selected to generate one or more edge regions, and the present application does not limit the number of edge regions.

[0079] The sizes of the above-mentioned central region and edge regions can be set according to requirements. In order to improve the statistical accuracy, the central region is selected to be relatively large, and the four corners are selected to be relatively small to facilitate the detection of the background region.

[0080] After the central region and the edge regions are obtained, the brightness Y1, Y2, Y3, and Y4 of each edge region in the edge regions 520, 530, 540, and 550 is calculated, and the average brightness (Y ave =(Y1+Y2+Y3+Y4) / 4) of the edge regions is taken as the brightness of the edge regions, and the brightness Y center of the central region is calculated.

[0081] The difference between the brightness value of the central region and the brightness value of the edge region is calculated to obtain the target brightness difference.

[0082] S430, determining whether the target brightness difference is greater than or equal to a preset threshold.

[0083] As Figure 5 , in an ideal region of interest with an ideal size, the face region should be contained in the circular region 560, and the region 570 other than the circular region 560 is the background region. In this case, the difference between the brightness Y center of the central region and the brightness Y ave of the edge region is not large.

[0084] In the case where the region of interest is too large and contains part of the background region, the edge region also contains a large amount of background region, resulting in a high brightness of the edge region, and the difference Y diff (Y diff =|Y ave -Y center |) between the two is large.

[0085] If the target brightness difference is greater than the preset threshold, it is considered that the region of interest contains part of the background region.

[0086] S440, adjusting the size of the first region of interest according to the target brightness difference to obtain a second region of interest.

[0087] The target reduction coefficient is determined according to the preset corresponding relationship between the brightness difference value and the reduction coefficient and the target brightness difference value; the first region of interest is reduced by the target reduction coefficient to generate the second region of interest; or the first region of interest is reduced by a preset reduction coefficient to generate the second region of interest.

[0088] When the region of interest is too large and contains part of the background region, the size of the region of interest is reduced.

[0089] The corresponding relationship between the brightness difference value and the reduction coefficient can be preset, for example, when the brightness difference value is 40, the reduction is 2 times, when the brightness difference value is 60, the reduction is 3 times, and when the brightness difference value is 100, the reduction is 4.5 times.

[0090] The target reduction coefficient is determined according to the preset corresponding relationship between the brightness difference value and the reduction coefficient and the target brightness difference value.

[0091] Alternatively, a preset reduction coefficient is preset, and when the target brightness difference value is greater than or equal to a preset threshold, the preset reduction coefficient is obtained.

[0092] After the reduction coefficient is obtained, the first region of interest is reduced by the preset reduction coefficient to generate the second region of interest. For example, the size of the region of interest is represented as f size , the reduction coefficient is represented as s, and the second region of interest f size-2 can be represented as f size-2 =f size-1 *s.

[0093] Optionally, the first region of interest is reduced by the target reduction coefficient or the preset reduction coefficient to generate a third region of interest; a new brightness difference value of a central region and an edge region of the third region of interest is obtained; when the new brightness difference value is greater than or equal to the preset threshold, the third region of interest is reduced by the target reduction coefficient or the preset reduction coefficient at least once to obtain a fourth region of interest, the brightness difference value of the central region and the edge region of the fourth region of interest is less than the preset threshold, and the fourth region of interest is determined as the second region of interest; when the new brightness difference value is less than the preset threshold, the third region of interest is determined as the second region of interest. The edge region includes a corner region where a vertex of a target rectangular region is located, and the target rectangular region is any one of the first region of interest, the second region of interest, the third region of interest, and the fourth region of interest. In the iteration, the selection of the central region and the edge region should comply with the same selection principle to ensure accuracy.

[0094] In an embodiment of the present application, the reduction of the region of interest is an iterative process: obtaining a central region and an edge region of the central region of the region of interest, calculating a brightness difference value of the central region and the edge region, when the brightness difference value is greater than or equal to a preset threshold, reducing the region of interest using a preset reduction coefficient to obtain a new region of interest, until the brightness difference value is less than the preset threshold. That is, iterations are performed on the above steps 410 to 440.

[0095] The brightness difference value less than the preset threshold indicates that the edge brightness and the center brightness are close, that is, most of the face region is within the region of interest.

[0096] S450, determining the brightness of the second region of interest as the face brightness of the image.

[0097] According to the preset brightness algorithm, the brightness of the second region of interest is calculated as the face brightness of the image.

[0098] The above face brightness calculation method sets four regions at the corners of the region of interest to calculate the brightness, compares the brightness of the four corners and the center region, detects the background region, and reduces the region of interest, thereby excluding the influence of the brightness of the background region on the calculation of the face brightness, achieving simplicity, high implementation efficiency and reliability. Avoids the error caused by the shape and posture of the face, or the movement of the face and the camera, which causes the edge of the face frame to contain the background part, and brings error to the face brightness calculation.

[0099] Figure 6 The structure diagram of the face brightness calculation device provided by the embodiment of the present application is shown in FIG. 6. Figure 6 As shown in FIG. 6, the device 600 includes a first acquisition module 610, a second acquisition module 620, an adjustment module 630 and a calculation module 640, wherein:

[0100] The first acquisition module is configured to acquire a first region of interest in an image, and the first region of interest includes a face.

[0101] The second acquisition module is configured to determine a target brightness difference value between a central region and an edge region of the first region of interest.

[0102] The adjustment module is configured to adjust the size of the first region of interest according to the target brightness difference value to obtain a second region of interest.

[0103] The calculation module is configured to determine the brightness of the second region of interest as the face brightness of the image.

[0104] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment related to the method, and will not be described in detail here.

[0105] Figure 7 is a block diagram of an electronic device 700 according to an example embodiment. As shown, the electronic device 700 can include a processor 701, a memory 702. The electronic device 700 can also include one or more of a multimedia component 703, an input / output (I / O) interface 704, and a communication component 705. Figure 7

[0106] ​The processor 701 is configured to control overall operations of the electronic device 700 to complete all or part of the steps of the face brightness calculation method described above. The memory 702 is configured to store various types of data to support operations of the electronic device 700, which can include, for example, instructions for operating any application or method on the electronic device 700, and application-related data, such as contact data, sent and received messages, pictures, audio, video, and the like. The memory 702 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic disk, or an optical disk. The multimedia component 703 can include a screen and an audio component. The screen can be, for example, a touch screen, and the audio component is configured to output and / or input audio signals. For example, the audio component can include a microphone configured to receive external audio signals. The received audio signals can be further stored in the memory 702 or transmitted through the communication component 705. The audio component also includes at least one speaker configured to output audio signals. The I / O interface 704 provides an interface between the processor 701 and other interface modules, which can be a keyboard, a mouse, a button, and the like. The buttons can be virtual buttons or physical buttons. The communication component 705 is configured to perform wired or wireless communication between the electronic device 700 and other devices. The wireless communication, such as Wi-Fi, Bluetooth, near field communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, and the like, or a combination of one or more of them, is not limited herein. Therefore, the corresponding communication component 705 can include a Wi-Fi module, a Bluetooth module, an NFC module, and the like.

[0107] In an exemplary embodiment, the electronic device 700 can be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors, or other electronic elements for performing the above-mentioned face brightness calculation method.

[0108] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, which, when executed by a processor, implement the steps of the above-mentioned face brightness calculation method. For example, the computer-readable storage medium can be the above-mentioned memory 702 including program instructions, which can be executed by the processor 701 of the electronic device 700 to complete the above-mentioned face brightness calculation method.

[0109] In another exemplary embodiment, a computer program product is also provided, which contains a computer program capable of being executed by a programmable device, and the computer program has code portions for executing the above-mentioned face brightness calculation method when executed by the programmable device.

[0110] The preferred embodiments of the present application are described in detail above with reference to the accompanying drawings, but the present application is not limited to the specific details of the above-described embodiments. Within the technical concept of the present application, various simple modifications can be made to the technical solutions of the present application, and these simple modifications all belong to the protection scope of the present application.

[0111] In addition, it should be noted that each specific technical feature described in the above specific embodiments can be combined in any appropriate manner without contradiction. In order to avoid unnecessary repetition, various possible combinations are not described again in the present application.

[0112] Furthermore, any combination of the various different embodiments of the present application can also be made, as long as it does not deviate from the idea of the present application, and it should also be considered as disclosed in the present application.

Claims

1. A face brightness calculation method, characterized by, The method comprises: acquiring a first region of interest in an image, the first region of interest comprising a human face; determining a target brightness difference between a central region and an edge region of the first region of interest; adjusting the size of the first region of interest according to the target brightness difference to acquire a second region of interest; determining the brightness of the second region of interest as the brightness of the human face in the image; the step of adjusting the first region of interest according to the brightness difference to acquire a second region of interest comprises: determining a target reduction coefficient according to a preset correspondence between a brightness difference and a reduction coefficient and the target brightness difference; reducing the first region of interest by the target reduction coefficient to generate the second region of interest; or reducing the first region of interest by a preset reduction coefficient to generate the second region of interest.

2. The method of claim 1, wherein, Before the step of adjusting the first region of interest according to the brightness difference to acquire a second region of interest, the method further comprises: determining that the target brightness difference is greater than or equal to a preset threshold.

3. The method of claim 2, wherein, the step of reducing the first region of interest by the target reduction coefficient or a preset reduction coefficient to generate the second region of interest comprises: reducing the first region of interest by the target reduction coefficient or a preset reduction coefficient to generate a third region of interest; acquiring a new brightness difference between a central region and an edge region of the third region of interest; when the new brightness difference is greater than or equal to the preset threshold, reducing the third region of interest by the target reduction coefficient or a preset reduction coefficient at least once to acquire a fourth region of interest, the brightness difference between the central region and the edge region of the fourth region of interest being less than the preset threshold, and determining the fourth region of interest as the second region of interest; when the new brightness difference is less than the preset threshold, determining the third region of interest as the second region of interest.

4. The method according to any one of claims 1 to 3, characterized in that, When the edge region comprises a plurality of regions, the brightness of the edge region is determined by calculating the average brightness of all the regions.

5. The method of claim 4, wherein, The edge region comprises a corner region in which a vertex of a target rectangular region is located, each corner region having a preset region size, and the target rectangular region being any one of the first region of interest, the second region of interest, the third region of interest, and the fourth region of interest.

6. The method of claim 1, wherein, The first region of interest is obtained by detecting the image based on deep learning target detection or directly based on the features of the image.

7. A face brightness calculating apparatus characterized by comprising: The device comprises: a first acquisition module configured to acquire a first region of interest in an image, the first region of interest comprising a human face; a second acquisition module configured to determine a target brightness difference between a central region and an edge region of the first region of interest; an adjustment module configured to adjust the size of the first region of interest according to the target brightness difference to acquire a second region of interest; a calculation module configured to determine the brightness of the second region of interest as the brightness of the human face in the image; The adjusting module is specifically configured to determine a target reduction coefficient according to a preset corresponding relationship between a brightness difference value and a reduction coefficient and the target brightness difference value; generate the second region of interest by reducing the first region of interest at a same ratio according to the target reduction coefficient; or generate the second region of interest by reducing the first region of interest at a same ratio according to a preset reduction coefficient.

8. A computer-readable storage medium having stored thereon a computer program, characterized in that, The program, when executed by a processor, implements the steps of the method of any one of claims 1-6.

9. An electronic device, comprising: The program, when executed by a processor, implements the steps of the method of any one of claims 1-6. The program, when executed by a processor, implements the steps of the method of any one of claims 1-6. The program, when executed by a processor, implements the steps of the method of any one of claims 1-6. The program, when executed by a processor, implements the steps of the method of any one of claims 1-6. The program, when executed by a processor, implements the steps of the method of any one of claims 1-6. The program, when executed by a processor, implements the steps of the method of any one of claims 1-6. The program, when executed by a processor, implements the steps of the method of any one of claims 1-6. The program, when executed by a processor, implements the steps of the method of any one of claims 1-6. The program, when executed by a processor, implements the steps of the method of any one of claims 1-6. The program, when executed by a processor, implements the steps of the method of any one of claims 1-6.

Citation Information

Patent Citations

  • Intelligent exposure method and system based on face recognition

    CN105516613A

  • Face exposure adjustment method and device, equipment terminal and readable storage medium

    CN113989909A