Image white balance adjusting method and device, image sensing equipment and storage medium

By acquiring the constraint relationship between the chrominance component and the brightness component of the image, determining the effective white point and performing white balance correction, the problem of light changes affecting image white balance in the prior art is solved, and image quality is improved.

CN119854471APending Publication Date: 2025-04-18JINAN BYD SEMICON TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410362253.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-27
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

When performing image white balance adjustment, the prior art is affected by light changes, resulting in poor image white balance correction effect and lowering image quality.

Method used

By obtaining the constraint relationship between the chrominance component and the luminance component of the target input image, effective white points are determined, and based on these white points and RGB images, the gain coefficient is calculated for white balance correction.

Benefits of technology

It improves the accuracy of white point detection, enhances the white balance correction effect of the image, and thus improves the image quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119854471A_ABST
    Figure CN119854471A_ABST
Patent Text Reader

Abstract

The invention provides an image white balance adjusting method and device and image sensing equipment. The method comprises the following steps: acquiring a constraint relationship between a chrominance component and a brightness component of a target input image; determining effective white points in the target input image according to the constraint relation; and determining a white balance correction image according to the effective white points and an RGB image corresponding to the target input image. In the white balance correction process, the constraint relation between the chrominance component and the brightness component of the target input image is considered, the influence of illumination change on the image is reduced, the constraint relation serves as one of the conditions of white point detection, the candidate white points of the target input image are detected, the accuracy of white point detection is greatly improved, and the accuracy of white point detection is improved. Therefore, while the white balance correction effect of the image is improved, the image quality is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a method and device for adjusting the white balance of an image, an image sensing device and a storage medium. Background Art

[0002] In the related art, during the white balance adjustment process, it will be limited by the influence of light changes. When there is a certain light or exposure area in the image, it will affect the white balance correction effect of the image, thereby reducing the image quality. Summary of the invention

[0003] The present invention aims to solve at least one of the technical problems existing in the prior art.

[0004] To this end, an object of the present invention is to provide a method for adjusting the white balance of an image, which method greatly improves the accuracy of white point detection, thereby improving the image quality while improving the white balance correction effect of the image.

[0005] Therefore, a second object of the present invention is to provide a device for adjusting the white balance of an image.

[0006] To this end, a third object of the present invention is to provide a non-transitory computer-readable storage medium.

[0007] To this end, a fourth object of the present invention is to provide an image sensing device.

[0008] In order to achieve the above-mentioned purpose, an embodiment of the first aspect of the present invention proposes a method for adjusting the white balance of an image, comprising: obtaining a constraint relationship between a chromaticity component and a luminance component of a target input image; determining a valid white point in the target input image according to the constraint relationship; and determining a white balance correction image according to the valid white point and an RGB image corresponding to the target input image.

[0009] According to the image white balance adjustment method of the embodiment of the present invention, during the white balance correction process, the constraint relationship between the chromaticity component and the brightness component of the target input image is taken into account, thereby reducing the impact of lighting changes on the image. The constraint relationship is used as one of the conditions for white point detection to detect candidate white points of the target input image, thereby greatly improving the accuracy of white point detection, thereby improving the image quality while improving the white balance correction effect of the image.

[0010] In addition, the image white balance adjustment method according to the above embodiment of the present invention may also have the following additional technical features:

[0011] In some embodiments, determining the effective white point in the target input image according to the constraint relationship includes: acquiring a target pixel point in the target input image that satisfies the constraint relationship; and using the target pixel point as the effective white point.

[0012] In some embodiments, obtaining the constraint relationship between the chrominance component and the luminance component of the target input image includes: obtaining a standard conversion relationship between the RGB space and the YCbCr space; and obtaining the constraint relationship according to the standard conversion relationship and the white balance ratio of the RGB space.

[0013] In some embodiments, the constraint relationship is obtained according to the standard conversion relationship and the white balance ratio of the RGB space, including: determining the conversion relationship between the chromaticity component and the brightness component according to the white balance ratio of the RGB space and the standard conversion relationship; and obtaining the constraint relationship according to the conversion relationship.

[0014] In some embodiments, the constraint relationship is obtained by substituting the chrominance component and the luminance component into the following formula, including:

[0015] nerual wait =β1<|Cb+Cr| / Y<β2

[0016] Wherein, Cb is the B chromaticity component, Cr is the R chromaticity component, Y is the luminance component, β1 is the lower limit value of the constraint relationship, β2 is the upper limit value of the constraint relationship, and the nerual wait is the constraint relationship.

[0017] In some embodiments, determining the effective white points in the target input image according to the constraint relationship includes: obtaining a dynamic detection change value; and determining the effective white points in the target input image according to the constraint relationship and the dynamic detection change value.

[0018] In some embodiments, obtaining a dynamic detection change value includes: obtaining the mean value of the mean values ​​of the chromaticity components of the target input image and the standard deviation value of the standard deviation of the chromaticity components; and obtaining the dynamic detection change value based on the chromaticity components, the mean value and the standard deviation value.

[0019] In some embodiments, the chroma component includes a B chroma component and an R chroma component, and the chroma component, the mean value, and the standard deviation mean are substituted into the following formula to obtain the dynamic detection change value, including:

[0020] b1=|Cb|-(1.5*Mb ave +Db ave *sign(Mb ave ))

[0021] b2=|Cr|-(1.5*Mr ave +Dr ave *sign(Mr ave ))

[0022] Wherein, b1 and b2 are the dynamic detection change values, |Cb| is the absolute value of the B chromaticity component, |Cr| is the absolute value of the R chromaticity component, and Mb ave is the average value of B, the Mr ave is the mean value of R, the Db ave is the mean value of the standard deviation of B, the Dr ave is the mean value of R standard deviation, the sign(Mb ave ) is the B signal value, the sign(Mr ave ) is the R signal value.

[0023] In some embodiments, determining effective white points in the target input image based on the constraint relationship and the dynamic detection change value includes: taking pixel points in the target input image whose dynamic detection change values ​​satisfy a preset dynamic detection threshold and target pixel points in the target input image that satisfy the constraint relationship as the effective white points.

[0024] In some embodiments, obtaining a target input image includes: obtaining an initial input image; dividing the initial input image into image blocks to obtain input image blocks; and when determining that the input image blocks satisfy set color conditions, using the input image blocks that satisfy the set color conditions as the target input image.

[0025] In some embodiments, determining whether the input image block satisfies a set color condition includes: obtaining a chroma component mean, a maximum brightness component, and a minimum brightness component corresponding to the chroma component of the input image block; determining a chroma component standard deviation based on the chroma component and the chroma component mean; determining a contrast of the input image block based on the maximum brightness component and the minimum brightness component; and determining that the input image block satisfies the set color condition when the chroma component standard deviation satisfies a set standard deviation threshold and the contrast satisfies a set contrast.

[0026] In some embodiments, before determining the white balance correction image based on the effective white points and the RGB image corresponding to the target input image, it also includes: when the number of the effective white points exceeds a set white point number threshold, obtaining overexposed points among the effective white points; and eliminating overexposed points among the effective white points.

[0027] In some embodiments, a white balance correction image is determined based on the effective white point and the RGB image corresponding to the target input image, including: obtaining the maximum brightness value of the target input image; calculating the white point mean of the effective white point in the RGB channel; determining the gain coefficient of the target input image in the RGB space based on the maximum brightness value and the mean of the white point; and determining the white balance correction image based on the gain coefficient and the RGB image.

[0028] In some embodiments, obtaining the maximum brightness value of the target input image includes: when the average standard deviation of the standard deviation of the chromaticity component of the target input image satisfies the set standard deviation threshold and the contrast satisfies the set contrast threshold, taking the maximum brightness component of the target input image as the maximum brightness value; when the average standard deviation of the standard deviation of the chromaticity component of the target input image does not satisfy the set standard deviation threshold and / or the contrast does not satisfy the set contrast threshold, determining the maximum brightness value based on the maximum brightness component and a set limit.

[0029] In some embodiments, determining the white balance correction image according to the gain coefficient and the RGB image includes: calculating the product of the gain coefficient and the RGB image component to obtain the white balance correction image.

[0030] In some embodiments, before obtaining the overexposure point in the effective white point, the method further includes: if the brightness value of the effective white point is greater than a preset overexposure point threshold, determining that the effective white point is the overexposure point.

[0031] The second aspect of the present invention proposes a white balance adjustment device for an image, comprising: an acquisition module, used to obtain the constraint relationship between the chromaticity component and the brightness component of the target input image; a first determination module, used to determine the effective white point in the target input image according to the constraint relationship; and a second determination module, used to determine the white balance correction image according to the effective white point and the RGB image corresponding to the target input image.

[0032] According to the white balance adjustment device for an image of an embodiment of the present invention, the constraint relationship between the chromaticity component and the brightness component of the target input image is taken into account, the influence of illumination changes on the image is reduced, the constraint relationship is used as one of the conditions for white point detection, and the candidate white points of the target input image are detected, which greatly improves the accuracy of white point detection, thereby improving the image quality while improving the white balance correction effect of the image.

[0033] A third aspect of the present invention provides a non-temporary computer-readable storage medium on which a white balance adjustment program for an image is stored. When the white balance adjustment program for an image is executed by a processor, the white balance adjustment method for an image described in the above embodiment is implemented.

[0034] A fourth aspect of the present invention provides an image sensing device, comprising: the image white balance adjustment device described in the above embodiment; or, a processor, a memory, and an image white balance adjustment program stored in the memory and executable on the processor, wherein the image white balance adjustment program implements the image white balance adjustment described in the above embodiment when executed by the processor.

[0035] According to the image sensing device of the embodiment of the present invention, the constraint relationship between the chromaticity component and the brightness component of the target input image is taken into account, the influence of illumination changes on the image is reduced, the constraint relationship is used as one of the conditions for white point detection, and the candidate white points of the target input image are detected, which greatly improves the accuracy of white point detection, thereby improving the image quality while improving the white balance correction effect of the image.

[0036] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:

[0038] Figure 1 is a flow chart of a method for adjusting the white balance of an image according to an embodiment of the present invention;

[0039] Figure 2 is a schematic diagram of a test effect according to an embodiment of the present invention;

[0040] Figure 3 is a constraint relationship curve diagram between a luminance component and a chrominance component according to an embodiment of the present invention;

[0041] Figure 4 is a schematic diagram of image block division according to an embodiment of the present invention;

[0042] Figure 5 is an overall flow chart of a method for adjusting white balance of an image according to an embodiment of the present invention;

[0043] Figure 6 is a structural block diagram of a white balance adjustment device for an image according to an embodiment of the present invention;

[0044] Figure 7 is a structural block diagram of an image sensing device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0045] Embodiments of the present invention are described in detail below. The embodiments described with reference to the accompanying drawings are exemplary. Embodiments of the present invention are described in detail below.

[0046] In the related art, white balance algorithms include global adjustment and local adjustment. Global adjustment refers to processing the entire frame of the image to directly determine the white point range, such as the gray world algorithm and the perfect reflection algorithm; local adjustment refers to dividing a frame of the image and only adjusting the white balance of the parts that meet the conditions, such as the dynamic threshold white balance algorithm.

[0047] At present, the premise of the grayscale world algorithm is to assume that the image is very colorful, and the mean of the three channels of RGB is close to a fixed grayscale value. The algorithm considers this fixed value to be a "gray" value, and then processes the relationship of the same object under different lighting according to the diagonal matrix method to achieve the purpose of adjusting the white balance. The specific implementation process is: input the image, judge the color richness according to the input image, if the image is judged to be very colorful, calculate the mean of R, G, B and the mean of the three means, and then calculate the gain coefficient to obtain the adjusted value, and output the image after adjustment. If the image color does not meet the color richness, the image is directly output. However, the practical application of the grayscale world algorithm is very limited. When the image color is relatively single and the mean fails to approach the ideal fixed value, the algorithm effect will not be very ideal or even fail.

[0048] The premise of the perfect reflection method is to assume that there must be a white pixel or a brightest point in the image. In the subsequent adjustment, this point is used as the reference white point. Then, it is assumed that there is a mirror in the image, and this mirror can completely reflect the color information under a specific light source. Then, the color information in the mirror can be obtained as the real light source information of the image. The specific implementation process is: according to the input image, the sum of the three channel values ​​of R, G, and B is counted, and the maximum value in each channel is determined from the three channels. Then, the ratio and threshold are set, and all the pixels in the image whose sum of the three channel values ​​is greater than the threshold are found and the mean is calculated. The gain is adjusted to obtain the adjusted value to adjust the image, and finally the image is output. However, in the perfect reflection method, if the assumption does not exist and the brightest point in the image is not the assumed white point, the effect of the algorithm will be very poor or even invalid.

[0049] The dynamic threshold white balance algorithm is actually a combination of the gray world algorithm and the perfect reflection algorithm. The algorithm is equivalent to considering two parts. In the early stage, the image is divided into 12 blocks to select a colorful image, and then the fixed chromaticity value mean is calculated, and the point that is stable near the mean is used as the candidate reference white point; in the later stage, according to the perfect reflection method, the point with the highest brightness value is selected from the candidate reference white points as the final reference white point, and then the maximum brightness value of the image and the mean of the white points of the three channels are calculated, and the maximum brightness value is compared with the three means respectively. This ratio is used as a gain coefficient to adjust the three RGB channels to correct the image. However, the dynamic threshold white balance algorithm is relatively complex and will be affected by changes in illumination. When there are certain illumination or exposure areas in the image, the image effect will be greatly reduced; in addition, the image division and the detection of the algorithm white point do not take into account the occupation of the hardware area, which will also have a certain impact on the actual industrial implementation.

[0050] Therefore, the embodiment of the present invention adds constraint conditions, detects white points, improves the accuracy of white point detection, and also takes into account the occupation of hardware area, so that the image effect is significantly improved, thereby improving the accuracy of image white balance adjustment.

[0051] In order to solve the above problems, an object of the present invention is to provide a method for adjusting the white balance of an image, which can improve the accuracy of adjusting the white balance of the image.

[0052] Reference below Figure 1-Figure 5 The white balance adjustment method of an image according to an embodiment of the present invention is described. Figure 1 As shown, the adjustment method at least includes steps S1 to S3.

[0053] Step S1, obtaining the constraint relationship between the chrominance component and the luminance component of the target input image.

[0054] The target input image is an image that has been divided into image blocks and whose color richness meets the set conditions. The target input image is obtained by performing spatial transformation, image block division and color richness judgment on the initial input image.

[0055] In an embodiment, after acquiring the target input image, a constraint relationship between the chromaticity component and the brightness component of the target input image is established, wherein the chromaticity component of the image is the color information in the image, and the brightness component of the image is the brightness of the image, that is, a constraint relationship between Y and Cb, Cr is established. By establishing a constraint relationship between the chromaticity components Cb, Cr and the brightness component Y, it is convenient to perform white point detection on the target input image according to the constraint relationship.

[0056] Step S2, determining valid white points in the target input image according to the constraint relationship.

[0057] In an embodiment, determining a valid white point in a target input image can be understood as identifying and screening out the pixel points in the target input image that are most likely to represent true white based on a constraint relationship. For example, a candidate white point that satisfies the constraint relationship is selected from the candidate white points in the target input image based on the constraint relationship, i.e., a target pixel point, and the target pixel point is used as a valid white point. By adding a constraint relationship between a chromaticity component and a luminance component, and detecting the candidate white points of the target input image based on the constraint relationship, the detection accuracy of the white points can be greatly improved.

[0058] Step S3, determining a white balance correction image according to the effective white point and the RGB image corresponding to the target input image.

[0059] In an embodiment, the effective white point in the target input image is determined, and then the maximum brightness value of the target input image is obtained and the white point mean of the effective white point in the RGB channel is calculated, so that the gain coefficient of the target input image in the RGB space can be determined according to the maximum brightness value and the white point mean, and then the image can be white-balanced according to the gain coefficient and the RGB image corresponding to the target input image to generate a final corrected image.

[0060] According to the image white balance adjustment method of the embodiment of the present invention, the constraint relationship between the chromaticity component and the brightness component of the target input image is taken into account, the influence of illumination change on the image is reduced, the constraint relationship is used as one of the conditions for white point detection, and the candidate white points of the target input image are detected, which greatly improves the accuracy of white point detection, thereby improving the image quality while improving the white balance correction effect of the image.

[0061] In one embodiment of the present invention, determining effective white points in a target input image according to a constraint relationship includes: acquiring target pixel points in the target input image that satisfy the constraint relationship; and using the target pixel points as effective white points.

[0062] In an embodiment, after acquiring the target input image, white point detection is performed on the target input image to determine the pixel points in the target input image that satisfy the constraint relationship, and the pixel points in the target input image that satisfy the constraint relationship are recorded as target pixel points. The target pixel points are used as valid white points, and white point detection is performed on the target input image through the constraint relationship, thereby improving the accuracy of white point detection and thus improving the white balance correction effect of the image.

[0063] In one embodiment of the present invention, obtaining the constraint relationship between the chrominance component and the luminance component of the target input image includes: obtaining the standard conversion relationship between the RGB space and the YCbCr space; and obtaining the constraint relationship according to the standard conversion relationship and the white balance ratio of the RGB space.

[0064] In the embodiment, a standard conversion relationship between the RGB space and the YCbCr space is obtained to facilitate conversion of the RGB value into the YCbCr value, and the white balance ratio is a parameter in the RGB space for describing the color shift of the white point under different light sources. Under different lighting conditions, the white point in the image may present different color shifts, which can be quantified by the ratio of the RGB components. Thus, the standard conversion relationship between the RGB space and the YCbCr space is obtained according to the standard. The white balance ratio of the RGB space is, for example, R:G:B=1:1:1. The constraint relationship can be determined based on the obtained standard conversion relationship and the white balance ratio of the RGB space. In this process, the conversion between the RGB space and the YCbCr space is adopted, and the occupancy of the hardware information is taken into account, which is beneficial to the storage and calculation of the hardware.

[0065] In one embodiment of the present invention, the constraint relationship is obtained according to the standard conversion relationship and the white balance ratio of the RGB space, including: determining the conversion relationship between the chromaticity component and the brightness component according to the white balance ratio of the RGB space and the standard conversion relationship; and obtaining the constraint relationship according to the conversion relationship.

[0066] In an embodiment, after obtaining the standard conversion relationship, the conversion relationship between the chromaticity component and the brightness component is determined according to the standard conversion relationship and the white balance ratio. The conversion relationship between the chromaticity component and the brightness component is the conversion relationship between the chromaticity component and the brightness component obtained when the ratio of the white balance in the RGB space is 1:1:1, that is, when the values ​​of the three RGB channels are equal. Therefore, a constraint relationship can be further obtained according to the determined conversion relationship between the chromaticity component and the brightness component, so as to identify and screen the valid white points in the target input image according to the constraint relationship, thereby improving the accuracy of detecting white points.

[0067] In one embodiment of the present invention, the chrominance component and the brightness component are substituted into the following formula to obtain a constraint relationship, including:

[0068] nerual wait =β1<|Cb+Cr| / Y<β2…(1)

[0069] Among them, Cb is the B chromaticity component, Cr is the R chromaticity component, Y is the brightness component, β1 is the lower limit of the constraint relationship, β2 is the upper limit of the constraint relationship, and nerual wait For constraint relationship.

[0070] Specifically, Cb and Cr are obtained after certain processing in practical applications. The chromaticity value of each pixel value is subtracted from 128 and the absolute value is taken, that is, Cb = |Cb(i,j)-128|, Cr = |Cr(i,j)-128|, and then the sum of Cb and Cr is compared with the brightness value Y to obtain |Cb+Cr| / Y.

[0071] In the embodiment, the constraint relationship is derived based on the formula of converting RGB space to YCbCr space, wherein the standard conversion relationship of RGB space to YCbCr space is:

[0072]

[0073] In the standard conversion relationship, R, G, and B are the chromaticity components of the three channels in the RGB space, namely, the R chromaticity component, the G chromaticity component, and the B chromaticity component. The conversion relationship between the chromaticity component and the brightness component can be determined based on the standard conversion relationship and the white balance ratio of the RGB space. After the conversion relationship is determined, the constraint relationship is obtained based on the conversion relationship, that is, formula (1) is obtained, where β1 is the lower limit value of the constraint relationship, β2 is the upper limit value of the constraint relationship, and nerual wait For constraint relationship.

[0074] It can be understood that the constraint lower limit β1 and the constraint upper limit β2 are set through experimental tests, which are obtained by testing from pure black to pure white and pure white images with brightness. The test results can be referred to Figure 2 .

[0075] like Figure 3 FIG. 1 is a schematic diagram of a constraint relationship curve of an embodiment of the present invention. Figure 3 It can be seen that the upper limit value of the constraint relationship and the lower limit value of the constraint relationship are obtained through experimental tests, and white point detection is performed on the target input image according to the YCbCr constraint relationship.

[0076] In one embodiment of the present invention, determining effective white points in a target input image according to a constraint relationship includes: obtaining a dynamic detection change value; and determining effective white points in the target input image according to the constraint relationship and the dynamic detection change value.

[0077] Among them, the principle of dynamically detecting the change value is still the gray world algorithm. When the image is rich in color, the mean of the three channels in the RGB space is a fixed value, while in the YCbCr space, it is equivalent to selecting a stable value of the color difference value, which can be understood as a pixel point near the mean.

[0078] In an embodiment, obtaining dynamic detection change values ​​can improve the accuracy of white balance processing. For example, an image may have different color shifts under different lighting conditions, and using a fixed detection threshold may not achieve good results in all cases. Combined with the constraint relationship, the valid white points in the target input image can be identified, thereby enhancing the accuracy of detecting the white point range and improving the accuracy of white point detection.

[0079] In one embodiment of the present invention, obtaining a dynamic detection change value includes: obtaining the mean value of the chromaticity component means and the standard deviation value of the chromaticity component standard deviation of the target input image; and obtaining the dynamic detection change value according to the chromaticity component, the mean value and the standard deviation value.

[0080] In an embodiment, chromaticity components are obtained from a target input image, and then the mean and standard deviation of each chromaticity component are calculated, wherein the mean of the chromaticity component can reflect the deviation of the chromaticity value, and the standard deviation of the chromaticity component can reflect the discrete degree of the image pixels, and the larger the standard deviation of the chromaticity component, the richer the color of the image. It is further necessary to calculate the mean average of the mean of the chromaticity component and the standard deviation average of the chromaticity component standard deviation, and the dynamic detection change value can be obtained according to the calculated chromaticity component, mean average and standard deviation average.

[0081] In one embodiment of the present invention, the chroma component includes a B chroma component and an R chroma component, and the chroma component, the mean value, and the standard deviation mean value are substituted into the following formula to obtain a dynamic detection change value, including:

[0082] b1=|Cb|-(1.5*Mb ave +Db ave *sign(Mb ave ))…(3)

[0083] b2=|Cr|-(1.5*Mr ave +Dr ave *sign(Mr ave ))…(4)

[0084] Among them, b1 and b2 are dynamic detection change values, |Cb| is the absolute value of the B chromaticity component, |Cr| is the absolute value of the R chromaticity component, and Mb ave is the average value of B, Mr ave is the average value of R, Db ave is the mean value of the standard deviation of B, Dr ave is the mean value of R standard deviation, sign(Mb avE ) is the B signal value, sign(Mr AVe ) is the R signal value.

[0085] In an embodiment, the dynamic detection change value may be obtained by substituting the chrominance component, the mean value and the standard deviation value into the formula, wherein the chrominance component includes a B chrominance component and an R chrominance component, namely, a B chrominance component Cb and an R chrominance component Cr.

[0086] Specifically, b1 and b2 are the differences between the B chromaticity component value and the R chromaticity component value and the adjusted mean. The two differences b1 and b2 change according to the changes of each pixel, that is, they are dynamically adjusted. When the two differences meet certain conditions, it means that the color temperature has not changed suddenly, and each corresponding pixel is a white point, where the condition is: b1<|ω*Db Ave |b2<|ω*Dr ave |,|ω*Db ave |、|ω*Dr ave | is the preset dynamic detection threshold.

[0087] Substituting the B chromaticity component Cb, the average value of the B chromaticity component Cb and the average value of the standard deviation of the B chromaticity component Cb into formula (3), the dynamic detection change value b1 calculated based on the B chromaticity component can be obtained; similarly, substituting the R chromaticity component Cr, the average value of the R chromaticity component Cr and the average value of the standard deviation of the R chromaticity component Cr into formula (4), the dynamic detection change value b2 calculated based on the R chromaticity component can be obtained, where |Cb| is the absolute value of the B chromaticity component, |Cr| is the absolute value of the R chromaticity component, and Mb is ave is the average value of B, Mr ave is the average value of R, Db ave is the mean value of the standard deviation of B, Dr ave is the mean value of R standard deviation, sign(Mb ave ) is the B signal value, sign(Mr ave ) is the R signal value.

[0088] In a specific embodiment, the B signal value sign (Mb ave ) can be understood as the signal adjusted according to the color difference value deviation in the process of detecting the white point, B standard deviation mean Db ave According to the B mean Mb ave Make corresponding adjustments, then the B signal value sign(Mb ave ) will play a role in regulating the signal, that is, the B signal value sign (Mb ave ) can be understood as ±1, if the mean of the standard deviation of B is Db ave Mb ave Large, B signal value sign(Mb ave ) is set to -1, if the mean of the standard deviation of B is Db ave Mb ave Small, B signal value sign(Mb ave ) is set to +1 to increase the mean of the B standard deviation Db ave Adjusted to B mean Mb ave nearby.

[0089] Similarly, the R signal value sign(Mr ave ) can be understood as the signal adjusted according to the color difference value deviation in the process of detecting white point, R standard deviation mean Dr ave According to the R mean Mr ave Make corresponding adjustments, then the R signal value sign(Mr ave ) will play the role of a regulating signal, that is, the R signal value sign (Mr ave ) can be understood as ±1. If the mean value of the standard deviation of R is Dr ave R-mean average Mr ave Large, R signal value sign (Mr ave ) is set to -1, if the mean of the R standard deviation Dr ave R-mean average Mr ave Small, R signal value sign(Mr ave ) is set to +1 to increase the R standard deviation to mean Dr ave Adjusted to R mean Mr ave This process can be understood as a color temperature estimation process, that is, in the process of white point detection, in order to improve the accuracy of dynamic detection of change values, the influence of the standard deviation of the chromaticity component on the degree of offset is increased. Specifically, whether the color temperature has a sudden change is judged according to the degree of offset between the chromaticity component and the mean of the chromaticity component. When the chromaticity component and the mean of the chromaticity component are greatly different, it means that the color temperature has a sudden change, and then an offset is made. If the color temperature has no sudden change, no offset is made. At this time, the accuracy of white point detection can be improved by increasing the influence of the standard deviation of the chromaticity component on the degree of offset and performing an offset based on the relationship between the average value of the standard deviation of the chromaticity component and the mean of the chromaticity component.

[0090] Specifically, the chromaticity component mean and the chromaticity component standard deviation mean are calculated according to the chromaticity component, which can be obtained by the following formula:

[0091]

[0092]

[0093]

[0094]

[0095] Among them, x and y can be understood as each image block is understood as a rectangle after the image block is divided, x is the length of the image block, y is the width of the image block, then x*y can be expressed as the total number of all pixels in the image block, and i represents all values ​​of the image pixel in the x dimension, j represents all values ​​of the image pixel in the y dimension; Cb(i,j) and Cr(i,j) are the B chromaticity value and R chromaticity value of each pixel respectively; Mb is the mean of the Cb chromaticity values ​​of all pixels in the image block, and Mr is the mean of the Cr chromaticity values ​​of all pixels in the image block. The mean can reflect the central trend of the chromaticity value, that is, The average color offset of the image block; Db can reflect the degree of discreteness between the B chromaticity value in the image block and its mean Mb. The square of the difference between the B chromaticity value Cb(i,j) of each pixel in the image block and its mean Mb is summed, and the square root is taken and then divided by the total number of all pixels in the image block x*y to obtain the B chromaticity standard deviation Db; Dr can reflect the degree of discreteness between the R chromaticity value in the image block and its mean Mr. The square of the difference between the R chromaticity value Cr(i,j) of each pixel in the image block and its mean Mr is summed, and the square root is taken and then divided by the total number of all pixels in the image block x*y to obtain the R chromaticity standard deviation Dr.

[0096] After obtaining the mean and standard deviation according to the chromaticity value, the mean, standard deviation and contrast of the image blocks that meet the color richness are then averaged, that is,

[0097]

[0098]

[0099]

[0100]

[0101]

[0102] Specifically, the mean of all B chromaticity components is summed and compared with the total to obtain the B mean value Mb ave , that is, summing up the mean of the B chromaticity components with a total number of count to obtain Ratio it with the total count to get Mb ave Similarly, the mean of all R chromaticity components is summed and compared with the total to obtain the R mean value Mr ave The sum of the standard deviations of all B chromaticity components and the ratio of the sum to the total number can give the average value of the B standard deviation Db ave The sum of the standard deviations of all R chromaticity components and the ratio of the sum to the total number can give the average R standard deviation Dr ave , sum up all contrast values ​​and then compare them with the total number to get the contrast average value C_m_ave.

[0103] If the test result obtained according to the above calculation result is that all image blocks are very simple, then keep the original image output. ave , R mean average Mr ave , B standard deviation mean Db ave , R standard deviation mean Dr ave After obtaining the contrast average value C_m_ave, the value calculated based on the B chromaticity component is substituted into formula (3) to obtain the dynamic detection change value b1; the value calculated based on the R chromaticity component is substituted into formula (4) to obtain the dynamic detection change value b2. By obtaining the dynamic detection change value, the accuracy of white point detection can be improved.

[0104] In one embodiment of the present invention, valid white points in a target input image are determined based on constraint relationships and dynamic detection change values, including: taking pixel points in the target input image whose dynamic detection change values ​​satisfy a preset dynamic detection threshold and target pixel points in the target input image that satisfy the constraint relationship as valid white points.

[0105] In the embodiment, for each pixel point in the target input image, the pixel point whose dynamic detection change value in the target input image satisfies the preset dynamic detection threshold, wherein the dynamic detection change values ​​are b1 and b2, and the preset dynamic detection threshold is |ω*Db ave |、|ω*Dr vve |, that is, satisfying b1<|ω*Db ave |b2<|ω*Dr ave |Pixel points, combined with target pixel points in the target input image that satisfy the constraint relationship, can be used as valid white points. Thus, the valid white points in the target input image are determined according to the constraint relationship and the dynamic detection change value, which enhances the accuracy of the white point detection range and can improve the accuracy of white point detection.

[0106] In one embodiment of the present invention, obtaining a target input image includes: obtaining an initial input image; dividing the initial input image into image blocks to obtain input image blocks; and when it is determined that the input image blocks meet set color conditions, using the input image blocks that meet the set color conditions as the target input image.

[0107] The initial input image is an image to be processed provided according to requirements, and is usually an original, unprocessed image.

[0108] In an embodiment, an initial input image is obtained, the image is divided into a plurality of image blocks, and a reference is made to Figure 4As shown, the whole frame image can be divided into 2^4=16 image blocks, because image block division can improve the compression rate of the image and reduce the storage and transmission costs; in the field of digital technology, according to the binary calculation method, the resolution of the image pixel is calculated as an exponential power of 2 in inches, so here it is chosen to be divided into 2^4=16 blocks for calculation; in addition, the image in the processor will be processed faster and with higher calculation accuracy by the GPU (Graphic Processing Unit) under the exponential power of 2. After the image block division is completed, color analysis is performed on each image block to determine whether the input image block meets the set color condition, and the input image block that meets the set color condition is selected from all the divided image blocks as the target input image. The image block division method is used to improve the efficiency and accuracy of image processing.

[0109] Among them, after obtaining the initial input image, the initial input image is spatially transformed and then divided to obtain input image blocks. When YCbCr performs spatial adjustment, according to the sampling format, the RGB space needs to occupy a larger bit space during transmission and storage. When the YCbCr space adopts a set format, the bit space required to save the set bit brightness value of each pixel is smaller, that is, the image data is compressed by half, which greatly saves storage space.

[0110] In one embodiment of the present invention, determining that an input image block satisfies a set color condition includes: obtaining a chroma component mean, a maximum brightness component, and a minimum brightness component corresponding to the chroma component of the input image block; determining a chroma component standard deviation according to the chroma component and the chroma component mean; determining a contrast of the input image block according to the maximum brightness component and the minimum brightness component; and determining that the input image block satisfies the set color condition when the chroma component standard deviation satisfies a set standard deviation threshold and the contrast satisfies a set contrast.

[0111] In the embodiment, the chromaticity component (i.e., the B chromaticity component and the R chromaticity component) is extracted from the input image block. The mean Mb of the B chromaticity component can be calculated according to formula (5), and the mean Mr of the R chromaticity component can be calculated according to formula (6). Then, the standard deviation of the B chromaticity component is determined according to the B chromaticity component and the mean Mb of the B chromaticity component. For example, the standard deviation of the B chromaticity component is recorded as Db, and its calculation formula is (7); the standard deviation of the R chromaticity component is determined according to the R chromaticity component and the mean Mr of the R chromaticity component. For example, the standard deviation of the R chromaticity component is recorded as Dr, and its calculation formula is (8). By calculating the standard deviation of the chromaticity component, the fluctuation range of the chromaticity value in the image block can be understood. At the same time, the maximum brightness component (referred to as Ymax) and the minimum brightness component (referred to as Ymin) in the image block are found. The maximum brightness component Ymax represents the brightest pixel in the image block, and the minimum brightness component Ymin represents the darkest pixel in the image block. The contrast C of the input image block is determined according to the maximum brightness component Ymax and the minimum brightness component Ymin. m , the calculation formula is C m =(Ymax+Ymin) / (Ymax-Ymin).

[0112] Specifically, C. m is the Michelson contrast, which adds the discrimination condition of color richness; Ymax and Ymin represent the maximum and minimum brightness in the image block respectively, the sum of the maximum brightness and the minimum brightness in the image is recorded as Ymax+Ymin, the difference between the maximum brightness and the minimum brightness in the image is recorded as Ymax-Ymin, and then the contrast C can be obtained by the ratio of the sum of the maximum brightness and the minimum brightness to the difference between the maximum brightness and the minimum brightness (Ymax+Ymin) / (Ymax-Ymin). m After the chromaticity component standard deviation and contrast are obtained, it is further necessary to determine whether the chromaticity component standard deviation meets the set standard deviation threshold and whether the contrast meets the set contrast. If the chromaticity component standard deviation is within an acceptable range and the contrast is within an appropriate limited threshold, it can be determined that the input image block meets the set color condition.

[0113] Specifically, whether an image block meets a set color condition is determined according to the standard deviation of the chromaticity component and the contrast, which can be judged by a formula, that is, Db>α, Dr>α, Cm>γ, wherein α and γ are fixed limiting thresholds, which can be set according to specific implementations. An image block whose standard deviation Db of the B chromaticity component and standard deviation Dr of the R chromaticity component are both greater than the set standard deviation threshold α, and whose contrast Cm is greater than the set contrast γ can be judged as a colorful image block. Compared with performing white point detection on each image block separately through experimental tests, the present invention sets color conditions, and this process improves the speed of detecting white points.

[0114] In one embodiment of the present invention, before determining the white balance correction image based on the effective white points and the RGB image corresponding to the target input image, it also includes: when the number of effective white points exceeds a set white point number threshold, obtaining overexposed points among the effective white points; and eliminating the overexposed points among the effective white points.

[0115] In an embodiment, an overexposed point generally refers to a pixel point in an image with abnormal brightness due to overexposure. If the overexposed points are not eliminated during the white balance correction process, the final effect of the algorithm may be greatly reduced due to different brightness. If there are too many overexposed points in the image block, the final result will present a whole frame of white image. Therefore, to prevent this from happening, before determining the white balance correction image based on the RGB image corresponding to the effective white points and the target input image, the number of effective white points may be detected. If the number of effective white points exceeds the set white point number threshold, these white points may be further analyzed to identify the overexposed points among the effective white points, and then eliminate the overexposed points among the effective white points to ensure that the subsequent white balance correction will not be affected by the overexposed points, thereby improving the accuracy of the white balance correction.

[0116] In one embodiment of the present invention, a white balance correction image is determined based on an effective white point and an RGB image corresponding to a target input image, including: obtaining a maximum brightness value of the target input image; calculating a white point mean value of the effective white point in the RGB channels; determining a gain coefficient of the target input image in the RGB space based on the maximum brightness value and the mean value of the white point; and determining a white balance correction image based on the gain coefficient and the RGB image.

[0117] In the embodiment, the maximum brightness value is extracted from the target input image and recorded as Y_max. At the same time, the white point average of the effective white point on the RGB channels is calculated, that is, the brightness average on the R channel is recorded as R_ave, the brightness average on the G channel is recorded as G_ave, and the brightness average on the B channel is recorded as B_ave. Therefore, the gain coefficient of the target input image in the RGB space can be determined according to the maximum brightness value Y_max and the average of the white points of each color channel. The gain coefficient is calculated by calculating the white point average of the three channels, and then the three averages are respectively compared with the maximum brightness value, that is,

[0118] R_Gain=Y_max / R_ave

[0119] G_Gain=Y_max / G_ave…(14)

[0120] B_Gain=Y_max / B_ave

[0121] The gain coefficient on the R channel is recorded as R_Gain, the gain coefficient on the G channel is recorded as G_Gain, and the gain coefficient on the B channel is recorded as B_Gain. Thus, the calculated gain coefficients are applied to the RGB image of the target input image to generate a white balance correction image.

[0122] In one embodiment of the present invention, obtaining the maximum brightness value of the target input image includes: when the standard deviation average value of the standard deviation of the chromaticity component of the target input image meets the set standard deviation threshold and the contrast meets the set contrast threshold, taking the maximum brightness component of the target input image as the maximum brightness value; when the standard deviation average value of the standard deviation of the chromaticity component of the target input image does not meet the set standard deviation threshold and / or the contrast does not meet the set contrast threshold, determining the maximum brightness value according to the maximum brightness component and a set limit value.

[0123] In the embodiment, the standard deviation of the chromaticity component of the target input image, that is, the standard deviation Db of the B chromaticity component and the standard deviation Dr of the R chromaticity component are calculated, the standard deviation average value is calculated according to the standard deviation of the chromaticity component, the standard deviation average value of the chromaticity component standard deviation is compared with the set standard deviation threshold, and the contrast is compared with the set contrast threshold. If the standard deviation average value Db_ave of the B chromaticity component standard deviation and the standard deviation average value Dr_ave of the R chromaticity component standard deviation are greater than the set standard deviation threshold α1 and the contrast C_m is greater than the set contrast threshold γ1, the maximum brightness component max(Lu) in the target input image can be taken as the maximum brightness value Y max If the standard deviation average value Db_ave of the standard deviation of the B chromaticity component and the standard deviation average value Dr_ave of the standard deviation of the R chromaticity component do not meet the set standard deviation threshold α1 and / or the contrast C_m does not meet the set contrast threshold γ1, according to the maximum brightness component max(Lu) and the set limit Determines the maximum brightness value.

[0124] Specifically, contrast is used to detect brightness values. When the contrast is large, it means that the brightness values ​​are distributed in very bright or very dark areas. Medium contrast means that the tones range from very dark to very bright and contain rich tones. Low contrast means that the tones are mainly concentrated in the middle part, with few brighter or darker points. This method still chooses medium contrast for detection. And according to the principles of the gray world method and the perfect reflection method, the premise is that the color of the image is very rich. The detection conditions here add the constraints of Db_ave and Dr_ave to improve the accuracy of white point detection. When the above two constraints are met, the maximum brightness value is selected. When they are not met, certain restrictions are set on the brightness value. It can be specifically expressed by the following formula:

[0125]

[0126] Among them, α1 is the set standard deviation threshold, and γ1 is the set contrast threshold.

[0127] In one embodiment of the present invention, determining a white balance correction image according to a gain coefficient and an RGB image includes: calculating the product of the gain coefficient and the RGB image component to obtain the white balance correction image.

[0128] In the embodiment, the gain coefficient in the RGB space is calculated, which can be used to adjust the brightness value of each channel to achieve white balance, and at the same time, the R color component (denoted as R.), G color component (denoted as G.) and B color component (denoted as B.) of each pixel of the RGB image to be corrected are obtained, and finally, the image components of the three RGB channels are multiplied by the corresponding gain coefficients to obtain new values ​​of the three channels, that is,

[0129]

[0130] Among them, R_new is the new image component value of the R channel, G_new is the new image component value of the G channel, and B_new is the new image component value of the B channel. Thus, the product of the gain coefficient and the RGB image component is calculated to finally obtain a new corrected image, thereby obtaining a white balance corrected image.

[0131] In one embodiment of the present invention, before obtaining the overexposure point in the effective white point, the method further includes: if the brightness value of the effective white point is greater than a preset overexposure point threshold, determining that the effective white point is an overexposure point.

[0132] In an embodiment, the identification of overexposure points can be achieved by comparing the brightness value of the effective white point with the preset overexposure point threshold, that is, Y=y(i)<μ, i∈(1,2,3…count), μ is the set overexposure point threshold, y(i) is the brightness value of the effective white point, and i is an integer greater than 0. If the brightness value y(i) of the white point exceeds the set overexposure point threshold μ, it is considered to be an overexposure point.

[0133] Reference below Figure 5 The white balance adjustment method of an image according to an embodiment of the present invention is described in detail, and the specific steps are as follows.

[0134] Step S11, obtaining an initial input image.

[0135] Step S12, dividing the initial input image into image blocks to obtain input image blocks.

[0136] Step S13, obtaining the chrominance component mean, maximum luminance component and minimum luminance component corresponding to the chrominance component of each input image block.

[0137] Step S14, determining the standard deviation of the chrominance component according to the chrominance component and the mean value of the chrominance component; determining the contrast according to the maximum brightness component and the minimum brightness component.

[0138] Step S15, determining whether the standard deviation of each chromaticity component in the image block meets the set standard deviation threshold and whether the contrast meets the set contrast threshold (i.e., image color richness determination). If so, executing step S18; if not, executing step S16.

[0139] Step S16: No processing is performed and the number of single-color image blocks is counted.

[0140] Step S17, determine whether the number is equal to the divided image block value, if so, execute step S36.

[0141] Step S18, obtaining the average value of the chroma component means and the average value of the standard deviation of the chroma component standard deviation of the target input image (ie, the image block that satisfies the color richness).

[0142] Step S19, obtaining a standard conversion relationship between the RGB space and the YCbCr space.

[0143] Step S20, obtaining the ratio of the white balance in the RGB space.

[0144] Step S21, determining the range of the ratio of the chromaticity component to the brightness component according to the approximate range of the white balance ratio in the RGB space and the standard conversion relationship.

[0145] Step S22, determining a constraint relationship according to a range of a ratio of a chroma component to a luminance component.

[0146] Step S23, obtaining a dynamic detection change value according to the difference between the chrominance component and the adjusted mean value.

[0147] Step S24, determining a constraint relationship according to the magnitude relationship between the dynamic detection change value and the adjusted standard deviation value, wherein the adjusted standard deviation is the speech dynamic detection threshold.

[0148] Step S25, determine whether the two constraints are satisfied, if so, execute step S27; if not, execute step S26.

[0149] Step S26: Not a valid white point.

[0150] Step S27, determining the effective white point.

[0151] Step S28, obtaining the maximum brightness value of the pixel values ​​in the effective white points.

[0152] Step S29, determining whether the brightness value of the effective white point is less than a preset overexposure point threshold, if so, executing step S31; if not, executing step S30.

[0153] Step S30, obtaining and removing overexposed points.

[0154] Step S31, obtaining a valid white point.

[0155] Step S32, adjusting the brightness value of the effective white point.

[0156] Step S33, calculating the mean value of the effective white points.

[0157] Step S34, calculating the gain coefficient.

[0158] Step S35, calculating the product of the gain coefficient and the RGB image component to obtain an image after white balance correction.

[0159] Step S36, output the image.

[0160] In summary, in the white balance correction process, the constraint relationship between the chromaticity component and the brightness component of the target input image is taken into account, and the constraint relationship is used as one of the conditions for white point detection. The dynamic detection change value is obtained according to the chromaticity component, the average value of the mean and the average value of the standard deviation. The dynamic detection change value is used as another condition for white point detection. The effective white point of the target input image is detected by combining the constraint relationship and the dynamic detection change value, which greatly improves the accuracy of white point detection, thereby improving the image quality while improving the white balance correction effect of the image. In addition, the image block division method is adopted, and the occupation of the hardware area is taken into account, so that the image effect is significantly improved, thereby improving the accuracy of the image white balance adjustment.

[0161] In summary, in images with very rich colors, the grayscale world algorithm and the embodiments of the present invention have better effects; in color-rich images with a single brightness background, the embodiments of the present invention and the original dynamic threshold classic technology have relatively excellent effects; in images with a certain exposure area, only the embodiments of the present invention correct the original color of the image, and other technologies are ineffective; although the present invention is not the best in images with more brightness and reference white points, from the perspective of human eye observation, the effect of correcting the image of the present invention is relatively good. Finally, a pure red image without white points is tested. Because the image has no reference white point, white balance should not be performed. The original dynamic threshold algorithm and the technology of the present invention both maintain the original image output, while the grayscale world algorithm adjusts the image to a darker color, and the perfect reflection law is completely ineffective. Therefore, the present invention reduces the impact of light changes on the image, improves the image effect and the accuracy of white point detection.

[0162] The second embodiment of the present invention provides a white balance adjustment device for an image, such as Figure 6 As shown, the image white balance adjustment device 2 includes: an acquisition module 21 , a first determination module 22 and a second determination module 23 .

[0163] Among them, the acquisition module 21 is used to obtain the constraint relationship between the chromaticity component and the brightness component of the target input image; the first determination module 22 is used to determine the effective white point in the target input image according to the constraint relationship; the second determination module 23 is used to determine the white balance correction image according to the effective white point and the RGB image corresponding to the target input image.

[0164] According to the image white balance adjustment device 2 of the embodiment of the present invention, the constraint relationship between the chromaticity component and the brightness component of the target input image is taken into account, the influence of illumination change on the image is reduced, the constraint relationship is used as one of the conditions for white point detection, and the candidate white points of the target input image are detected, which greatly improves the accuracy of white point detection, thereby improving the image quality while improving the white balance correction effect of the image.

[0165] In one embodiment of the present invention, the first determination module 22 determines the effective white points in the target input image according to the constraint relationship, including: obtaining the target pixel points in the target input image that satisfy the constraint relationship; and taking the target pixel points as effective white points.

[0166] In one embodiment of the present invention, the acquisition module 21 acquires the constraint relationship between the chrominance component and the luminance component of the target input image, including: acquiring the standard conversion relationship between the RGB space and the YCbCr space; acquiring the constraint relationship according to the standard conversion relationship and the white balance ratio of the RGB space.

[0167] In one embodiment of the present invention, the constraint relationship is obtained according to the standard conversion relationship and the white balance ratio of the RGB space, including: determining the conversion relationship between the chromaticity component and the brightness component according to the white balance ratio of the RGB space and the standard conversion relationship; and obtaining the constraint relationship according to the conversion relationship.

[0168] In one embodiment of the present invention, the chrominance component and the brightness component are substituted into the following formula to obtain a constraint relationship, including:

[0169] nerual wait =β1<|Cb+Cr| / Y<β2

[0170] Among them, Cb is the B chromaticity component, Cr is the R chromaticity component, Y is the brightness component, β1 is the lower limit of the constraint relationship, β2 is the upper limit of the constraint relationship, and nerual wait For constraint relationship.

[0171] In one embodiment of the present invention, the first determination module 22 determines the effective white points in the target input image according to the constraint relationship, including: obtaining a dynamic detection change value; and determining the effective white points in the target input image according to the constraint relationship and the dynamic detection change value.

[0172] In one embodiment of the present invention, obtaining a dynamic detection change value includes: obtaining the mean value of the chromaticity component means and the standard deviation value of the chromaticity component standard deviation of the target input image; and obtaining the dynamic detection change value according to the chromaticity component, the mean value and the standard deviation value.

[0173] In one embodiment of the present invention, the chroma component includes a B chroma component and an R chroma component, and the chroma component, the mean value, and the standard deviation mean value are substituted into the following formula to obtain a dynamic detection change value, including:

[0174] b1=|Cb|-(1.5*Mb ave +Db ave *sign(Mb ave ))

[0175] b2=|Cr|-(1.5*Mr ave +Dr ave *sign(Mr ave ))

[0176] Among them, b1 and b2 are dynamic detection change values, |Cb| is the absolute value of the B chromaticity component, |Cr| is the absolute value of the R chromaticity component, and Mb ave is the average value of B, Mr ave is the average value of R, Db ave is the mean value of the standard deviation of B, Dr ave is the mean value of R standard deviation, sign(Mb ave ) is the B signal value, sign(Mr ave ) is the R signal value.

[0177] In one embodiment of the present invention, the first determination module 22 determines the effective white points in the target input image based on the constraint relationship and the dynamic detection change value, including: taking the pixel points in the target input image whose dynamic detection change values ​​meet the preset dynamic detection threshold and the target pixel points in the target input image that meet the constraint relationship as effective white points.

[0178] In one embodiment of the present invention, the acquisition module 21 acquires the target input image including: acquiring an initial input image; dividing the initial input image into image blocks to obtain input image blocks; and when it is determined that the input image blocks meet the set color conditions, taking the input image blocks that meet the set color conditions as the target input image.

[0179] In one embodiment of the present invention, determining that an input image block satisfies a set color condition includes: obtaining a chroma component mean, a maximum brightness component, and a minimum brightness component corresponding to the chroma component of the input image block; determining a chroma component standard deviation according to the chroma component and the chroma component mean; determining a contrast of the input image block according to the maximum brightness component and the minimum brightness component; and determining that the input image block satisfies the set color condition when the chroma component standard deviation satisfies a set standard deviation threshold and the contrast satisfies a set contrast.

[0180] In one embodiment of the present invention, before the second determination module 23 determines the white balance correction image based on the effective white points and the RGB image corresponding to the target input image, it also includes: when the number of effective white points exceeds a set white point number threshold, obtaining overexposed points among the effective white points; and eliminating overexposed points among the effective white points.

[0181] In one embodiment of the present invention, the second determination module 23 determines the white balance correction image according to the effective white point and the RGB image corresponding to the target input image, including: obtaining the maximum brightness value of the target input image; calculating the white point mean of the effective white point in the RGB channel; determining the gain coefficient of the target input image in the RGB space according to the maximum brightness value and the mean of the white point; and determining the white balance correction image according to the gain coefficient and the RGB image.

[0182] In one embodiment of the present invention, obtaining the maximum brightness value of the target input image includes: when the standard deviation average value of the standard deviation of the chromaticity component of the target input image meets the set standard deviation threshold and the contrast meets the set contrast threshold, taking the maximum brightness component of the target input image as the maximum brightness value; when the standard deviation average value of the standard deviation of the chromaticity component of the target input image does not meet the set standard deviation threshold and / or the contrast does not meet the set contrast threshold, determining the maximum brightness value according to the maximum brightness component and a set limit value.

[0183] In one embodiment of the present invention, the second determination module 23 determines the white balance correction image according to the gain coefficient and the RGB image, including: calculating the product of the gain coefficient and the RGB image component to obtain the white balance correction image.

[0184] In one embodiment of the present invention, before obtaining the overexposure point in the effective white point, the method further includes: if the brightness value of the effective white point is greater than a preset overexposure point threshold, determining that the effective white point is an overexposure point.

[0185] According to the image white balance adjustment device 2 of the embodiment of the present invention, the constraint relationship between the chromaticity component and the brightness component of the target input image is taken into account, the influence of illumination change on the image is reduced, the constraint relationship is used as one of the conditions for white point detection, and the candidate white points of the target input image are detected, which greatly improves the accuracy of white point detection, thereby improving the image quality while improving the white balance correction effect of the image.

[0186] A third aspect of the present invention provides a non-temporary computer-readable storage medium on which a white balance adjustment program for an image is stored, wherein the white balance adjustment program for an image, when executed by a processor, implements the white balance adjustment method for an image of the above embodiment.

[0187] A fourth aspect of the present invention provides an image sensing device.

[0188] In some embodiments, Figure 7 As shown, the image sensing device 3 includes the image white balance adjustment device 2 of the above embodiment.

[0189] In other embodiments, Figure 7 As shown, the image sensing device 3 includes: a processor 31, a memory 32, and an image white balance adjustment program stored in the memory 32 and executable on the processor 31. When the image white balance adjustment program is executed by the processor 31, the image white balance adjustment of the above-mentioned embodiment is implemented.

[0190] According to the image sensing device 3 of the embodiment of the present invention, during the white balance correction process, the constraint relationship between the chromaticity component and the brightness component of the target input image is taken into account, and the constraint relationship is used as one of the conditions for white point detection. The candidate white points of the target input image are detected, which greatly improves the accuracy of white point detection, thereby improving the image quality while improving the white balance correction effect of the image.

[0191] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example.

[0192] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.

Claims

1. A method for adjusting the white balance of an image, characterized in that: include: Obtain the constraint relationship between the chrominance component and the brightness component of the target input image; Determine the effective white points in the target input image according to the constraint relationship; A white balance correction image is determined according to the effective white point and the RGB image corresponding to the target input image.

2. The method for adjusting the white balance of an image according to claim 1, characterized in that: Determining effective white points in the target input image according to the constraint relationship includes: Acquire target pixel points satisfying the constraint relationship in the target input image; The target pixel point is used as the effective white point.

3. The method for adjusting the white balance of an image according to claim 1, characterized in that: Obtain the constraint relationship between the chrominance component and the brightness component of the target input image, including: Get the standard conversion relationship between RGB space and YCbCr space; The constraint relationship is acquired according to the standard conversion relationship and the white balance ratio of the RGB space.

4. The method for adjusting the white balance of an image according to claim 3, characterized in that: Acquiring the constraint relationship according to the standard conversion relationship and the white balance ratio of the RGB space includes: Determining a conversion relationship between the chromaticity component and the luminance component according to the white balance ratio of the RGB space and the standard conversion relationship; The constraint relationship is acquired according to the conversion relationship.

5. The method for adjusting the white balance of an image according to claim 1 or 4, characterized in that: Substituting the chrominance component and the brightness component into the following formula to obtain the constraint relationship includes: nerual wait =β1<|Cb+Cr| / Y<β2 Wherein, Cb is the B chromaticity component, Cr is the R chromaticity component, Y is the luminance component, β1 is the lower limit value of the constraint relationship, β2 is the upper limit value of the constraint relationship, and the nerual wait is the constraint relationship.

6. The method for adjusting the white balance of an image according to claim 1, characterized in that: Determining effective white points in the target input image according to the constraint relationship includes: Get dynamic detection change value; A valid white point in the target input image is determined according to the constraint relationship and the dynamic detection change value.

7. The method for adjusting the white balance of an image according to claim 6, characterized in that: Get dynamic detection change values, including: Obtaining the average of the means of the chrominance component means and the average of the standard deviations of the chrominance component standard deviations of the target input image; The dynamic detection change value is obtained according to the chrominance component, the mean average value and the standard deviation average value.

8. The method for adjusting the white balance of an image according to claim 7, characterized in that: The chroma component includes a B chroma component and an R chroma component. Substituting the chroma component, the mean value and the standard deviation mean value into the following formula to obtain the dynamic detection change value includes: b1=|Cb|-(1.5*Mb ave +Db ave *sign(Mb ave )) b2=|Cr|-(1.5*Mr ave +Dr ave *sign(Mr ave )) Wherein, b1 and b2 are the dynamic detection change values, |Cb| is the absolute value of the B chromaticity component, |Cr| is the absolute value of the R chromaticity component, and Mb avE is the average value of B, the Mr ave is the mean value of R, the Db ave is the mean value of the standard deviation of B, the Dr ave is the mean value of R standard deviation, the sign(Mb ave ) is the B signal value, the sign(Mr ave ) is the R signal value.

9. The method for adjusting the white balance of an image according to claim 6, characterized in that: Determining a valid white point in the target input image according to the constraint relationship and the dynamic detection change value includes: The pixel points whose dynamic detection change values ​​in the target input image meet the preset dynamic detection threshold and the target pixel points in the target input image that meet the constraint relationship are taken as the effective white points.

10. The method for adjusting the white balance of an image according to any one of claims 1 to 9, characterized in that: Obtaining the target input image includes: Get the initial input image; Dividing the initial input image into image blocks to obtain input image blocks; When it is determined that the input image block meets the set color condition, the input image block meeting the set color condition is used as the target input image.

11. The method for adjusting the white balance of an image according to claim 10, characterized in that: Determining whether the input image block satisfies a set color condition includes: Obtaining a chroma component mean, a maximum luminance component, and a minimum luminance component corresponding to the chroma component of the input image block; Determine a chrominance component standard deviation according to the chrominance component and the chrominance component mean; Determining a contrast of the input image block according to the maximum brightness component and the minimum brightness component; When the chrominance component standard deviation satisfies a set standard deviation threshold and the contrast satisfies a set contrast, it is determined that the input image block satisfies a set color condition.

12. The method for adjusting the white balance of an image according to claim 1, characterized in that: Before determining the white balance correction image according to the effective white point and the RGB image corresponding to the target input image, the method further includes: When the number of the effective white points exceeds a set white point number threshold, obtaining overexposed points among the effective white points; The overexposed points among the effective white points are eliminated.

13. The method for adjusting the white balance of an image according to claim 1 or 12, characterized in that: Determining a white balance correction image according to the effective white point and the RGB image corresponding to the target input image includes: Obtaining the maximum brightness value of the target input image; Calculate the white point mean value of the effective white point in the RGB channel; Determine a gain coefficient of the target input image in the RGB space according to the maximum brightness value and the average value of the white point; The white balance correction image is determined according to the gain coefficient and the RGB image.

14. The method for adjusting the white balance of an image according to claim 13, characterized in that: Obtaining the maximum brightness value of the target input image includes: When the average standard deviation of the standard deviation of the chromaticity component of the target input image meets the set standard deviation threshold and the contrast meets the set contrast threshold, taking the maximum brightness component of the target input image as the maximum brightness value; When the standard deviation average of the chromaticity component standard deviation of the target input image does not satisfy the set standard deviation threshold and / or the contrast does not satisfy the set contrast threshold, the maximum brightness value is determined according to the maximum brightness component and a set limit value.

15. The method for adjusting the white balance of an image according to claim 13, characterized in that: Determining the white balance correction image according to the gain coefficient and the RGB image includes: The product of the gain coefficient and the RGB image component is calculated to obtain the white balance corrected image.

16. The method for adjusting the white balance of an image according to claim 12, characterized in that: Before obtaining the overexposed point in the effective white point, the method further includes: If the brightness value of the effective white point is greater than a preset overexposure point threshold, the effective white point is determined to be the overexposure point.

17. A white balance adjustment device for an image, characterized in that: include: An acquisition module, used for acquiring the constraint relationship between the chrominance component and the brightness component of the target input image; A first determination module, configured to determine a valid white point in the target input image according to the constraint relationship; The second determination module is used to determine a white balance correction image according to the effective white point and the RGB image corresponding to the target input image.

18. A non-transitory computer-readable storage medium, characterized in that: The computer-readable storage medium stores a white balance adjustment program for an image, and when the white balance adjustment program for an image is executed by a processor, the white balance adjustment method for an image according to any one of claims 1 to 16 is implemented.

19. An image sensing device, characterized in that: include: The white balance adjustment device for an image as claimed in claim 17; or, A processor, a memory, and a white balance adjustment program for an image stored in the memory and executable on the processor, wherein the white balance adjustment program for an image, when executed by the processor, implements the white balance adjustment method for an image as described in any one of claims 1 to 16.