Balancing method and device of image illumination, equipment and storage medium

By dividing the image of the self-service photo-taking device into two areas, calculating the brightness difference, and balancing the lighting, the problem of uneven lighting is solved, thus improving the quality and utilization rate of ID photos.

CN116468631BActive Publication Date: 2026-01-27CHANGSHA XIONGDI XINAN TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202310400171.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-12
Publication Date
2026-01-27
Estimated Expiration
2043-04-12

AI Technical Summary

Technical Problem

Self-service photo booths often result in uneven lighting during the photo-taking process due to ambient light, leading to substandard ID photos and a high rate of rejected photos.

Method used

By dividing the L channel image of the image to be processed into two regions in the LAB color model, a first target image and a second target image are generated. The brightness value is calculated and a brightness difference image is generated. The brightness difference image is then merged with the image to be processed to perform illumination balance.

Benefits of technology

It achieves uniform image illumination, reduces the rate of unusable photos taken by the camera, and improves the utilization rate of finished photos.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116468631B_ABST
    Figure CN116468631B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a light balance method and device, equipment and a storage medium. The L channel picture in the LAB color model of the acquired to-be-processed image is divided into two regions, and a first target picture and a second target picture are generated. The brightness values of the first target picture and the second target picture are calculated respectively to obtain a first brightness value and a second brightness value. According to the sizes of the first brightness value and the second brightness value, the brightness difference of the first target picture and the second target picture is calculated to generate a brightness difference picture. The brightness difference picture is merged with the to-be-processed image to obtain a target image with balanced light. The L channel picture representing brightness is divided into two regions, the brightness values of the two regions are compared, the brightness difference on the same image is obtained, and the brightness difference picture is generated. The to-be-processed picture is adjusted based on the brightness difference picture to obtain an image with uniform brightness, so that the image meets the standard and the waste piece rate of the photographing device is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to methods, apparatus, devices and storage media for balancing illumination in images. Background Technology

[0002] Nowadays, many self-service photo booths have appeared on the market, and their application has brought great convenience to people who need to take photos.

[0003] However, during the application of self-service photo booths, uneven lighting can occur in the resulting photos due to the influence of ambient light. For example, self-service photo booths for ID cards may produce uneven lighting for various reasons during the shooting process. Relevant government departments have certain requirements for the image quality of ID photos, especially regarding the lighting of the face. Therefore, uneven lighting results in ID photos that do not meet the standards and are unusable, leading to a high rate of unusable photos from self-service photo booths. Summary of the Invention

[0004] Therefore, it is necessary to propose methods, devices, equipment, and storage media for balancing illumination in images to reduce the rate of rejected images.

[0005] To achieve the above objectives, a first aspect of this application provides a method for balancing illumination in an image, the method comprising:

[0006] Obtain the image to be processed, divide the L channel image of the image to be processed into two regions in the LAB color model, and generate a first target image and a second target image based on the two regions;

[0007] The brightness values ​​of the first target image and the second target image are calculated respectively to obtain the first brightness value and the second brightness value;

[0008] Based on the magnitudes of the first brightness value and the second brightness value, the brightness difference between the first target image and the second target image is calculated to generate a brightness difference image;

[0009] The brightness difference image is merged with the image to be processed to obtain the target image after balanced illumination.

[0010] Furthermore, the method for facial lighting balance in ID photos involves dividing the L channel image of the image to be processed into two regions using the LAB color model, and generating a first target image and a second target image based on the two regions. Specifically, this includes:

[0011] Based on the image to be processed, facial skin detection is performed to obtain a skin region image of the image to be processed.

[0012] The skin region image is converted from the original color model to the LAB color model, and the central axis is plotted for the nose tip feature points of the skin region image.

[0013] Using the central axis as the boundary, the L channel image in the LAB color model is divided into two regions: left and right face. A first target image containing the left face region and a second target image containing the right face region are generated.

[0014] Furthermore, the step of calculating the brightness difference between the first target image and the second target image based on the magnitudes of the first brightness value and the second brightness value, and generating a brightness difference image, specifically includes:

[0015] Using a defined central axis as the axis, the second target image is mirrored to obtain a first mirror image, and the second brightness value is used as the brightness value of the first mirror image.

[0016] Compare the first brightness value and the second brightness value, and subtract the image with the smaller brightness value from the image with the larger brightness value in the first target image and the first mirror image to obtain the brightness difference image.

[0017] Furthermore, the step of calculating the brightness values ​​of the first target image and the second target image respectively to obtain the first brightness value and the second brightness value specifically includes:

[0018] The average brightness of the non-zero regions of the first target image and the second target image is calculated respectively to obtain the first brightness value of the first target image and the second brightness value of the second target image.

[0019] Furthermore, before merging the brightness difference image with the image to be processed to obtain the target image after balanced illumination, the process further includes:

[0020] Remove pixels in the brightness difference image whose grayscale value is greater than a preset grayscale threshold, save pixels whose grayscale value is not greater than the grayscale threshold, and calculate the standard deviation and mean of the saved pixels.

[0021] Based on the standard deviation and the mean, the outliers in the brightness difference image are removed using the Laida criterion, resulting in a brightness difference image processed by outlier removal.

[0022] Furthermore, merging the brightness difference image with the image to be processed to obtain the target image after balanced illumination specifically includes:

[0023] Using a defined central axis as the axis, the brightness difference image is mirrored to obtain a second mirrored image;

[0024] The second mirror image, the brightness difference image, and the preset grayscale image are compared to calculate the grayscale value to obtain the adjusted image;

[0025] The adjusted image and the L-channel image are then overlaid with a soft light to obtain the target L-channel image;

[0026] The target image is obtained by merging the target L-channel image, the A-channel image and the B-channel image in the LAB color model of the image to be processed.

[0027] Furthermore, the step of calculating the grayscale values ​​of the second mirror image, the brightness difference image, and a preset grayscale image to obtain the adjusted image specifically includes:

[0028] When the first brightness value is not less than the second brightness value, the grayscale value of the brightness difference image is subtracted from the grayscale image and the grayscale value of the second mirror image is added to obtain the adjusted image;

[0029] When the first brightness value is less than the second brightness value, the grayscale image is added to the grayscale image and the grayscale value of the brightness difference image is subtracted to obtain the adjusted image.

[0030] To achieve the above objectives, a second aspect of this application provides an illumination balancing device in an image, the device comprising: an image acquisition unit, a parameter calculation unit, and an image processing unit;

[0031] The image acquisition unit is used to acquire the image to be processed, divide the L channel image of the LAB color model of the image to be processed into two regions, and generate a first target image and a second target image based on the two regions.

[0032] The parameter calculation unit is used to calculate the brightness values ​​of the first target image and the second target image respectively, to obtain the first brightness value and the second brightness value;

[0033] Based on the magnitudes of the first brightness value and the second brightness value, the brightness difference between the first target image and the second target image is calculated to generate a brightness difference image;

[0034] The image processing unit is used to merge the brightness difference image with the image to be processed to obtain a target image with balanced illumination.

[0035] To achieve the above objectives, a third aspect of this application provides a computer-readable storage medium storing a computer program, characterized in that, when the computer program is executed by a processor, the processor performs the steps of the method described in the first aspect.

[0036] To achieve the above objectives, a fourth aspect of this application provides a computer device including a memory and a processor, characterized in that the memory stores a computer program, which, when executed by the processor, causes the processor to perform the steps of the method described in the first aspect.

[0037] The embodiments of the present invention have the following beneficial effects:

[0038] The illumination balancing method of this invention divides the L-channel image of the acquired image to be processed into two regions in the LAB color model, and generates a first target image and a second target image based on the two regions; calculates the brightness values ​​of the first target image and the second target image respectively to obtain a first brightness value and a second brightness value; calculates the brightness difference between the first target image and the second target image based on the magnitude of the first brightness value and the second brightness value to generate a brightness difference image; merges the brightness difference image with the image to be processed to obtain a target image with balanced illumination. By dividing the L-channel image representing brightness into two regions and comparing the brightness values ​​of the two regions, the brightness difference on the same image is obtained, and a brightness difference image is generated. The image to be processed is adjusted based on the brightness difference image to obtain an image with uniform brightness, so that the image meets the standard and reduces the failure rate of the camera. Attached Figure Description

[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0040] in:

[0041] Figure 1 This is a flowchart illustrating the method for balancing illumination in photographs according to an embodiment of the present invention.

[0042] Figure 2 This is a flowchart illustrating the image region segmentation method according to an embodiment of the present invention;

[0043] Figure 3 This is a facial landmark calibration map according to an embodiment of the present invention;

[0044] Figure 4 This is an elliptical skin color model according to an embodiment of the present invention;

[0045] Figure 5a This is an example of a first target image according to an embodiment of the present invention;

[0046] Figure 5b This is an example of a second target image in an embodiment of the present invention;

[0047] Figure 6 This is a first mirror image of an embodiment of the present invention;

[0048] Figure 7 This is a brightness difference image according to an embodiment of the present invention;

[0049] Figure 8 This is an adjusted image in an embodiment of the present invention when the first brightness value is less than the second brightness value;

[0050] Figure 9 This is the adjusted image after filtering according to an embodiment of the present invention;

[0051] Figure 10 This is a structural block diagram of the illumination balancing device in an image according to an embodiment of the present invention;

[0052] Figure 11 This is a diagram showing the internal structure of a computer device in an embodiment of this application. Detailed Implementation

[0053] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0054] Since self-service photo-taking devices cannot adjust their shooting position and angle according to different lighting conditions like humans to obtain better photos, this invention provides a method for balancing lighting in images. This method addresses uneven lighting in photographs, resulting in images with uniform lighting and high image utilization. For details of the method, please refer to [link to method description]. Figure 1 , Figure 1 This is a flowchart illustrating a method for balancing illumination in an image according to an embodiment of the present invention. The method specifically includes:

[0055] Step 110: Obtain the image to be processed, divide the L channel image of the LAB color model of the image to be processed into two regions, and generate the first target image and the second target image based on the two regions.

[0056] Specifically, the image to be processed is obtained from the self-service photo-taking device. Before processing the image, it can be determined whether the image meets the final product standard. If the image meets the standard, no image processing is required, and the image can be directly output as the final product, avoiding unnecessary image processing. If the image does not meet the standard, the LAB color model of the image is obtained.

[0057] The LAB color model consists of three elements: lightness (L) and two color channels (A and B). The A channel encompasses colors ranging from dark green (low lightness value) to gray (medium lightness value) to bright pink (high lightness value); the B channel ranges from bright blue (low lightness value) to gray (medium lightness value) to yellow (high lightness value). Therefore, mixing these three elements produces an image with bright colors. Since the L channel represents the brightness of the image, the L channel of the LAB color model used for processing the image is chosen for illumination balancing.

[0058] Furthermore, the L-channel image is divided into two regions. The specific segmentation method can be determined based on the actual application scenario. For example, the division method can be determined based on the shape of the image. If the image is rectangular, it can be divided into two regions along any axis of symmetry, a diagonal, or N equal division lines, etc. Alternatively, it can be divided based on the brightness values ​​of the L-channel image, such as separating regions with higher average brightness values ​​from regions with lower average brightness values.

[0059] After dividing the L-channel image into regions, target images are generated, each containing the content of one region, resulting in a first target image and a second target image. For example, the first target image contains one region, and the second target image contains another region. By dividing the L-channel image into two target images and using them as reference images for subsequent illumination balancing processing, the illumination can be adjusted based on the original brightness of the image to be processed, resulting in a better final image.

[0060] Step 120: Calculate the brightness values ​​of the first target image and the second target image respectively to obtain the first brightness value and the second brightness value.

[0061] Since brightness values ​​can represent the degree of illumination of an image, after acquiring two target images, the brightness values ​​of the first and second target images can be calculated to obtain the degree of illumination of the two regions, so as to calculate the brightness difference of the image to be processed based on the brightness values ​​of the two regions.

[0062] Step 130: Calculate the brightness difference between the first target image and the second target image based on the magnitude of the first brightness value and the second brightness value, and generate a brightness difference image.

[0063] Specifically, after obtaining the first brightness value and the second brightness value, by comparing the two brightness values, the image with the higher brightness value in the first target image and the image with the lower brightness value are subtracted to obtain an image representing the brightness difference on the same image.

[0064] Step 140: Merge the brightness difference image with the image to be processed to obtain the target image after balanced illumination.

[0065] Since the brightness difference image represents the brightness difference between different areas of the same image, it can be superimposed with the unprocessed L-channel image to balance the image's illumination. Finally, the superimposed target L-channel image is merged with the original A-channel and B-channel images to obtain the balanced target image. By using the brightness difference image to adjust the brightness of the image to be processed, the overall brightness of the processed image becomes more uniform, resulting in a better final image.

[0066] The embodiments of the present invention can be applied to self-service photo-taking devices for ID photos. During the operation of the self-service photo-taking device for ID photos, due to the influence of ambient light, there may be uneven lighting on the face of the person, for example, one side of the face is brighter and the other side is darker, resulting in the finished photo not meeting the standards for ID photos. Therefore, the method proposed in the embodiments of the present invention is used for facial lighting balance in ID photos.

[0067] Typically, self-service photo booths for ID photos are placed in relatively enclosed spaces with adequate lighting. During normal operation, improper user operation can lead to lighting problems in the final image. For example, if a user enters the photo booth without closing the door or blackout curtain, ambient light may enter from one or more points, affecting the lighting conditions. Similarly, changing the lighting positions within the photo booth, such as adding or removing lighting devices on one or more sides of the user, will also affect the lighting conditions. Uneven lighting on the face will negatively impact the final image, typically resulting in one side of the face being brighter than the other. Therefore, in this embodiment of the invention, when acquiring the first target image and the second target image, the following method can be used... Figure 2 The image region segmentation method shown includes, specifically, step 110, dividing the L channel image of the image to be processed in the LAB color model into two regions, and generating a first target image and a second target image based on the two regions. This specifically includes:

[0068] Step 210: Perform facial skin detection based on the image to be processed to obtain the skin region image of the image to be processed.

[0069] This invention provides an embodiment for balancing the lighting of faces in ID photos. First, the image containing the face needs to be processed. Optionally, a deep learning algorithm can be used to calibrate facial key points. These key points include points in areas such as eyebrows, eyes, nose, mouth, and facial contours. (Refer to...) Figure 3, Figure 3 This is a face mapping image generated by identifying 68 key points to characterize a face. By calibrating these key points, the face region in the image to be processed is located and selected.

[0070] When detecting skin areas on a face, environmental noise is significant, and detection performance deteriorates under varying lighting conditions. The YCrCb color model, however, is less affected by lighting conditions, particularly the Cr and Cb channels, making it a commonly used color model for skin detection. Therefore, we choose to convert the image to the YCrCb color model for skin detection. For example, if the original color model is RGB, since RGB is easily affected by lighting while the Cr and Cb channels are less so, we convert the RGB model to YCrCb, perform channel separation, and then detect the skin areas of the face using the Cr and Cb channels.

[0071] The following section describes how to perform skin region detection, primarily using a preset skin model to detect the selected face region. The skin information of the face region in the image to be processed is mapped onto the CrCb two-dimensional space of the YCrCb color model, obtaining the coordinate information of each pixel in the face region in this two-dimensional space. Based on the coordinate information, it is determined whether the pixel falls on the preset skin model. For example, an elliptical skin model can be selected for detection. Please refer to [reference needed]. Figure 4 , Figure 4 In this embodiment of the invention, an elliptical skin color model is used. If a pixel is determined to be within the elliptical region, it is identified as skin; otherwise, it is identified as non-skin. Finally, all pixels identified as skin are integrated to obtain the skin region image. By performing skin detection on the face region, pixels that do not belong to skin, such as beards and eyebrows, can be excluded, resulting in more accurate adjustment results.

[0072] Step 220: Convert the skin region image from the original color model to the LAB color model, and construct the midline of the nose tip feature points in the skin region image.

[0073] Specifically, in order to obtain an image that can represent the degree of illumination on a face, the skin region image is converted from the original color model to the LAB color model in order to extract the L channel image representing the brightness of the skin region.

[0074] In ID photos, uneven lighting is a problem that manifests as different light intensities on the left and right sides of the face, resulting in one side of the face being darker and the other side being brighter. Therefore, in this embodiment of the invention, the skin region image is divided into left and right sides by drawing a central axis with the nose tip feature point as the reference point. By dividing the face into two regions, brightness analysis is performed based on the two regions of the face.

[0075] Step 230: Using the central axis as the boundary, divide the L channel image in the LAB color model into two regions, left and right face, and generate a first target image containing the left face region and a second target image containing the right face region.

[0076] Specifically, the LAB color model of the skin region image is subjected to channel separation to obtain an L-channel image. Using the central axis as the boundary, the face in the L-channel image is divided into left and right face regions. A target image is then generated based on each of the left and right face regions. (See reference...) Figure 5a and Figure 5b , Figure 5a This is an example of a first target image according to an embodiment of the present invention. Figure 5b This is an example of a second target image in an embodiment of the present invention. It can be seen that during the generation process, to achieve better results and facilitate processing, the target image is generated as close as possible to the proportions of the image to be processed, and the positions of each pixel remain unchanged for subsequent processing. By acquiring a target image containing the illumination characteristics of the left and right sides of the face, the facial illumination is balanced based on the target image representing the brightness of both sides of the face.

[0077] Furthermore, by calculating the brightness values ​​on both sides of the face, the degree of illumination on both sides of the face is determined. Therefore, in step 120, the brightness values ​​of the first target image and the second target image are calculated respectively to obtain the first brightness value and the second brightness value. Specifically, this includes: calculating the average brightness of the non-zero areas of the first target image and the second target image respectively to obtain the first brightness value of the first target image and the second brightness value of the second target image.

[0078] Understandably, lower brightness values ​​result in darker colors, while higher brightness values ​​result in lighter colors. When the brightness value is zero, the image appears black. By calculating the brightness values ​​on both sides of the face, the brightness values ​​of the non-zero areas in the first and second target images can be obtained respectively. Optionally, the brightness value can be the average brightness of all pixels in the non-zero area. After calculating the first and second brightness values, the degree of illumination on both sides of the face is determined based on the brightness values ​​of the two areas, and then the brightness difference is calculated.

[0079] After obtaining the first brightness value and the second brightness value, it is necessary to calculate the brightness difference image between the first target image and the second target image. Therefore, step 130 involves calculating the brightness difference between the first target image and the second target image based on the magnitude of the first brightness value and the second brightness value, generating a brightness difference image. Specifically, this includes:

[0080] Step 1: Using the determined central axis as the axis, mirror the second target image to obtain the first mirror image, and use the second brightness value as the brightness value of the first mirror image.

[0081] Step 2: Compare the first brightness value and the second brightness value, and subtract the image with the smaller brightness value from the image with the larger brightness value in the first target image and the first mirror image to obtain the brightness difference image.

[0082] Typically, a human face is considered a symmetrical shape. If one side of the face is mirrored around its central axis, an image approximately identical to the other side can be obtained. Therefore, in this embodiment of the invention, the facial region in the second target image, i.e., the right face image, is mirrored to obtain a mirrored image of the right face, i.e., the first mirrored image. (See reference...) Figure 6 , Figure 6 The first mirrored image in this embodiment of the invention is understood to have the same brightness value as the second target image. By mirroring the image, a facial image approximately identical to the left face is generated from the right face in the second target image. The resulting first mirrored image can then be used to calculate the brightness difference between the two faces by comparing it to the first target image. Specifically, the calculation involves first comparing the first and second brightness values; then subtracting the image with the smaller brightness value from the image with the larger value to obtain the brightness difference image. For example, when the first brightness value is not less than the second brightness value, the first mirrored image is subtracted from the first target image to obtain the brightness difference image; when the first brightness value is less than the second brightness value, the first target image is subtracted from the first mirrored image to obtain the brightness difference image. Generating the brightness difference image through mirroring is simple to operate and the calculation process is straightforward.

[0083] In addition, during actual operation, there may be a large difference between the left and right faces. After mirroring the second target image, the reversed right face is adjusted to the same size as the left face, making subsequent processing more convenient and reducing calculation errors.

[0084] To avoid the situation where the left and right faces do not overlap, which could affect the subsequent calculation results, in step 140, before merging the brightness difference image with the image to be processed to obtain the target image after balanced illumination, the following steps are also included:

[0085] Step 1: Remove pixels in the brightness difference image whose grayscale value is greater than the preset grayscale threshold, save pixels whose grayscale value is not greater than the grayscale threshold, and calculate the standard deviation and mean of the saved pixels.

[0086] Step 2: Based on the standard deviation and mean, process the image according to the Laida criterion to remove outliers from the brightness difference image, resulting in a brightness difference image after outlier processing.

[0087] Because human faces are not perfectly symmetrical, in images with varying brightness, pixels in non-overlapping areas may appear overly bright. (See also...) Figure 7 , Figure 7 In the case of a brightness difference image in this embodiment of the invention, to avoid this situation affecting subsequent processing, this embodiment of the invention removes pixels with gray values ​​greater than a preset gray value threshold from the brightness difference image, and only retains pixels with gray values ​​not greater than the gray value threshold. By removing pixels with excessively large gray values, the purpose of deleting non-overlapping parts is achieved.

[0088] To make the processing results more accurate, this embodiment of the invention also filters out abnormal points in the brightness difference image. Specifically, the standard deviation and mean of pixels whose gray values ​​are not greater than the gray value threshold are calculated, and abnormal points in the brightness difference image are removed according to the Laida criterion. That is, the gray value of the pixel is judged to be normal according to preset conditions. If it is normal, it is retained; if it is abnormal, the pixel is an abnormal point and is removed. Finally, the brightness difference image after removing abnormal points is obtained.

[0089] Optionally, the preset condition can be: mean-3*sigema≤x≤mean+3*sigema, where mean is the mean, sigema is the standard deviation, and x is the gray value of the pixel.

[0090] By filtering out non-overlapping parts and outliers in the brightness difference images, the brightness difference images are made more accurate, resulting in better effects after balanced lighting.

[0091] After obtaining the brightness difference image, illumination balancing processing is performed on the image to be processed based on the brightness difference image. Then, in step 140, the brightness difference image and the image to be processed are merged to obtain the target image after illumination balancing. Specifically, this includes:

[0092] Step 1: Using the determined central axis as the axis, mirror the brightness difference image to obtain a second mirror image. Calculate the grayscale values ​​of the second mirror image, the brightness difference image, and the preset grayscale image to obtain the adjusted image.

[0093] Since the brightness difference image only shows the left face area, it is mirrored to obtain a second mirrored image that includes the right face. Furthermore, a preset grayscale image is used as a reference image, and calculations are performed on the second mirrored image and the brightness difference image based on this grayscale image to obtain an adjusted image. Optionally, the preset grayscale image is a grayscale image with the same dimensions as the image to be processed, and all pixels have a grayscale value of 127.

[0094] Furthermore, the process of obtaining the adjusted image can be as follows: When the first brightness value is not less than the second brightness value, subtract the grayscale value of the brightness difference image from the preset grayscale value of the grayscale image and add the grayscale value of the second mirror image to obtain the adjusted image; when the first brightness value is less than the second brightness value, add the grayscale value of the brightness difference image to the preset grayscale value of the grayscale image and subtract the grayscale value of the second mirror image to obtain the adjusted image. (See also...) Figure 8 , Figure 8 This is an adjustment image where the first brightness value is less than the second brightness value in this embodiment of the invention. A neutral gray layer for adjustment is obtained by combining a second mirror image, a brightness difference image, and a preset grayscale image.

[0095] Step 2: Apply a soft light overlay to the adjusted image and the L channel image to obtain the target L channel image. Then, merge the target L channel image, the A channel image, and the B channel image from the LAB color model of the image to be processed to obtain the target image.

[0096] Specifically, after obtaining the image to be adjusted, a BoxFilter can be applied to it. (See reference...) Figure 9 , Figure 9 The image shown is a filtered adjusted image from an embodiment of the present invention, which makes the adjusted image smoother and improves the adjustment effect. After soft-light overlay of the adjusted image and the L-channel image and merging other components, the target image after illumination balance is obtained.

[0097] Alternatively, the formula for applying soft light overlay can be:

[0098] If A≤127, C=(2*A-1)*(BB*B)+B;

[0099] If A>127, C=(2*A-1)*(sqrt(B)-B)+B.

[0100] Where A is the grayscale value of the adjusted image, B is the grayscale value of the L channel image, and C is the grayscale value of the target L channel image.

[0101] The balancing method of this invention generates an adjusted image based on a brightness difference image, adjusts the illumination of the image to be processed, and obtains an image with uniform brightness so that the image meets the standard and reduces the failure rate of the camera.

[0102] This invention provides a device for balancing illumination in an image; please refer to [link / reference]. Figure 10 , Figure 10 This is a structural block diagram of an image illumination balancing device according to an embodiment of the present invention. The device includes: an image acquisition unit 1001, a parameter calculation unit 1002, and an image processing unit 1003.

[0103] Image acquisition unit 1001 is used to acquire the image to be processed, divide the L channel image of the LAB color model of the image to be processed into two regions, and generate a first target image and a second target image based on the two regions.

[0104] The parameter calculation unit 1002 is used to calculate the brightness values ​​of the first target image and the second target image respectively, so as to obtain the first brightness value and the second brightness value.

[0105] Based on the magnitude of the first brightness value and the second brightness value, the brightness difference between the first target image and the second target image is calculated to generate a brightness difference image.

[0106] Image processing unit 1003 is used to merge the brightness difference image with the image to be processed to obtain the target image after balanced illumination.

[0107] The balancing device in this embodiment of the invention divides the L-channel image, which represents brightness, into two regions, compares the brightness values ​​of the two regions to obtain the brightness difference on the same image, and generates a brightness difference image. Based on the brightness difference image, the image to be processed is adjusted to obtain an image with uniform brightness, so that the image meets the standard and reduces the failure rate of the camera.

[0108] Figure 11 An internal structural diagram of a computer device according to one embodiment of the present invention is shown. This computer device can specifically be a terminal or a system. Figure 11 As shown, the computer device includes a processor, memory, and network interface connected via a system bus. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and may also store a computer program. When executed by the processor, this computer program causes the processor to perform the steps in the above-described method embodiments. The internal memory may also store a computer program, which, when executed by the processor, causes the processor to perform the steps in the above-described method embodiments. Those skilled in the art will understand that... Figure 11 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0109] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps in the above method embodiments.

[0110] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, causes the processor to perform the steps in the above method embodiments.

[0111] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.

[0112] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0113] The above embodiments merely illustrate several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A method for balancing illumination in an image, characterized in that, The method includes: Obtain the image to be processed, divide the L channel image of the image to be processed into two regions in the LAB color model, and generate a first target image and a second target image based on the two regions; The brightness values ​​of the first target image and the second target image are calculated respectively to obtain the first brightness value and the second brightness value; Based on the magnitudes of the first brightness value and the second brightness value, the brightness difference between the first target image and the second target image is calculated to generate a brightness difference image; The brightness difference image is merged with the image to be processed to obtain the target image after balanced illumination; The step of merging the brightness difference image with the image to be processed to obtain the target image after balanced illumination specifically includes: Using a defined central axis as the axis, the brightness difference image is mirrored to obtain a second mirrored image; The second mirror image, the brightness difference image, and the preset grayscale image are compared to calculate the grayscale value to obtain the adjusted image; The adjusted image and the L-channel image are then overlaid with a soft light to obtain the target L-channel image; The target L-channel image, the A-channel image and the B-channel image in the LAB color model of the image to be processed are merged to obtain the target image; Specifically, the step of calculating the grayscale value of the second mirror image, the brightness difference image, and a preset grayscale image to obtain the adjusted image includes: When the first brightness value is not less than the second brightness value, the grayscale value of the brightness difference image is subtracted from the grayscale image and the grayscale value of the second mirror image is added to obtain the adjusted image; When the first brightness value is less than the second brightness value, the grayscale image is added to the grayscale image and the grayscale value of the brightness difference image is subtracted to obtain the adjusted image.

2. The method according to claim 1, characterized in that, The method for facial lighting balance in ID photos involves dividing the L channel image of the image to be processed into two regions using the LAB color model, and generating a first target image and a second target image based on these two regions. Specifically, this includes: Based on the image to be processed, facial skin detection is performed to obtain a skin region image of the image to be processed. The skin region image is converted from the original color model to the LAB color model, and the central axis is plotted for the nose tip feature points of the skin region image. Using the central axis as the boundary, the L channel image in the LAB color model is divided into two regions: left and right face. A first target image containing the left face region and a second target image containing the right face region are generated.

3. The method according to claim 1, characterized in that, The step of calculating the brightness difference between the first target image and the second target image based on the magnitudes of the first brightness value and the second brightness value, and generating a brightness difference image, specifically includes: Using a defined central axis as the axis, the second target image is mirrored to obtain a first mirror image, and the second brightness value is used as the brightness value of the first mirror image. Compare the first brightness value and the second brightness value, and subtract the image with the smaller brightness value from the image with the larger brightness value in the first target image and the first mirror image to obtain the brightness difference image.

4. The method according to claim 1, characterized in that, The step of calculating the brightness values ​​of the first target image and the second target image respectively to obtain the first brightness value and the second brightness value specifically includes: The average brightness of the non-zero regions of the first target image and the second target image is calculated respectively to obtain the first brightness value of the first target image and the second brightness value of the second target image.

5. The method according to claim 1, characterized in that, Before merging the brightness difference image with the image to be processed to obtain the target image after balanced illumination, the process further includes: Remove pixels in the brightness difference image whose grayscale value is greater than a preset grayscale threshold, save pixels whose grayscale value is not greater than the grayscale threshold, and calculate the standard deviation and mean of the saved pixels. Based on the standard deviation and the mean, the outliers in the brightness difference image are removed using the Laida criterion, resulting in a brightness difference image processed by outlier removal.

6. A device for balancing illumination in an image, characterized in that, The device includes: an image acquisition unit, a parameter calculation unit, and an image processing unit; The image acquisition unit is used to acquire the image to be processed, divide the L channel image of the LAB color model of the image to be processed into two regions, and generate a first target image and a second target image based on the two regions. The parameter calculation unit is used to calculate the brightness values ​​of the first target image and the second target image respectively, to obtain the first brightness value and the second brightness value; Based on the magnitudes of the first brightness value and the second brightness value, the brightness difference between the first target image and the second target image is calculated to generate a brightness difference image; The image processing unit is used to merge the brightness difference image with the image to be processed to obtain a target image with balanced illumination. The image processing unit is also used to mirror the brightness difference image using a defined central axis as the axis to obtain a second mirror image; The second mirror image, the brightness difference image, and the preset grayscale image are compared to calculate the grayscale value to obtain the adjusted image; The adjusted image and the L-channel image are then overlaid with a soft light to obtain the target L-channel image; The target L-channel image, the A-channel image and the B-channel image in the LAB color model of the image to be processed are merged to obtain the target image; The image processing unit is further configured to, when the first brightness value is not less than the second brightness value, subtract the grayscale value of the brightness difference image from the grayscale image and add the grayscale value of the second mirror image to obtain the adjusted image. When the first brightness value is less than the second brightness value, the grayscale image is added to the grayscale image and the grayscale value of the brightness difference image is subtracted to obtain the adjusted image.

7. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, the processor performs the steps of the method as described in any one of claims 1 to 5.

8. A computer device, comprising a memory and a processor, characterized in that, The memory stores a computer program that, when executed by the processor, causes the processor to perform the steps of the method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and device for identifying and adjusting human face luminance based on photographing

    CN104978710A

  • Multi-region non-uniform brightness distortion correction algorithm based on L-channel Gamma transformation

    CN112561829A

  • Non-uniform illumination image adaptive adjustment method

    CN114764832A

  • Image processing method and device, electronic equipment and storage medium

    CN115775215A