Improved image white balance adjustment method
By combining the global grayscale world method and the block statistical white block method, dynamically selecting suitable algorithms for white balance adjustment, the problem that white balance adjustment in the existing technology depends on specific scenarios, and achieves fast and accurate white balance calibration in various environments.
Patent Information
- Application Number
- CN202411842725.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-04-25
AI Technical Summary
Existing automatic white balance methods have the problem of relying on specific scenes or lighting conditions in performance, and cannot provide optimal white balance adjustments in all scenes and conditions, resulting in image color shifts or distortions.
An improved image white balance adjustment method is adopted, combining the global grayscale world method and the block statistical white block method, by dividing the image into multiple blocks, calculating the mean and weight of each block, calculating the global statistical value and white balance gain, and dynamically selecting the appropriate algorithm for white balance adjustment.
Fast and accurate automatic calibration in various complex environments, improving the accuracy, robustness and processing efficiency of white balance adjustment, and is suitable for a variety of high-resolution image processing equipment.
Smart Images

Figure CN119893309A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to an improved image white balance adjustment method. Background Art
[0002] In the image processing industry, the rise of automatic white balance algorithms has greatly improved image quality and the accuracy of color reproduction. Automatic white balance refers to the process of adjusting the gain of different color channels of the image during image analysis and processing to ensure that white remains white under different lighting conditions. This precise color adjustment is one of the key factors in achieving natural photographic images and is essential for both professional and consumer-level camera equipment. To date, there are two main types of automatic white balance methods: gray world method and white block method. The gray world method is a relatively simple algorithm that assumes that the average color of the image tends to approach neutral gray, so it changes the color gain by adjusting the total gray value of the image. Although this method is efficient, its performance is often unsatisfactory when the lighting conditions vary greatly or the image color distribution is uneven, especially in some special environments such as indoor environments or shadows. On the other hand, the white block method adjusts the white balance by identifying white or near-white areas in the image, thereby achieving image color correction. This method is particularly effective in situations where enough white areas can be found. However, once there is a lack of obvious white areas in the image or the white areas are blocked by other non-interesting objects, the performance of the algorithm will be greatly reduced.
[0003] These existing automatic white balance methods all have a common problem in performance, that is, they often rely on specific scenes or lighting conditions. They cannot guarantee that the white balance adjustment is optimal in all scenes and conditions. Therefore, in practical applications, these methods may cause color shift or distortion in the image. Therefore, an improved image white balance adjustment method is proposed to solve the above problem. Summary of the invention
[0004] In view of the deficiencies of the prior art, the present invention provides an improved image white balance adjustment method, which has the advantages of achieving fast and accurate automatic calibration in various complex environments, and solves the problems mentioned in the above background technology.
[0005] In order to achieve the purpose of fast and accurate automatic calibration under the above-mentioned various complex environments, the present invention provides the following technical solutions: an improved image white balance adjustment method, comprising the following steps: S1: Divide the image into N blocks and calculate N for each image block i The mean R i , G i With B i , calculate each image block N i The weight ω i, for the weight ω i Perform normalized weighting to obtain image block N i The global statistical value R of the R channel arv_1024 and the global statistics value B of channel B arv_1024 , calculate the white balance gain K of the global grayscale world R_global With K B_global , calculate the R channel gain K R With B channel gain K B ; S2: According to the R channel gain K R With B channel gain K B The number of white blocks in the image is calculated by multiplying the white balance gain parameter δ, and the number of white blocks Z is obtained by screening and eliminating. If the number of white blocks Z is ≤ 100, the process ends; otherwise, the process proceeds to step S3; S3: Calculate the global mean R of the R channel, G channel and B channel according to the calculated number of white blocks Z wb , G wb , and B wb , according to the global mean R wb , G wb , and B wb Calculate the white block gain K R_wb With the white block method gain K B_wb .
[0006] Preferably, the specific steps of step S1 are: S1.1: Divide the image into N blocks, N = 32*32 = 1024 blocks, the size of each image block is 64*64, and calculate the N of each image block separately. i The average of the R channel, G channel and B channel is denoted as R i , G i With B i ; S1.2: For each image block N i The weights of the dark area and over-exposed area are suppressed, and each image block N is calculated. i The weight ω i , the expression is: S1.3: Calculate each image block N i The weight ω i After that, the weight ω i Perform normalized weighting to obtain image block N i The global statistical value R of the R channel arv_1024 and the global statistics value B of channel B arv_1024 , the expression is: Where N is the total number of image blocks; S1.4: Calculate the white balance gain K of the global grayscale world R_global With K B_global , the expression is: Among them, G is the global G channel grayscale mean; S1.5: According to the calculated white balance gain K R_global With K B_globa Get the R channel gain K R With B channel gain K B .
[0007] Preferably, the step S2 is specifically: Calculate the number of white blocks, the expression is: Among them, K R is the R channel gain, K B is the B channel gain, δ is the white balance gain product parameter, and σ is the tolerance parameter; When the image block N i The gray value G of the G channel i <30,>220, remove these image blocks N i ; The number of white blocks that meet the characteristics after screening and elimination is recorded as Z.
[0008] Preferably, the step S3 is specifically: S3.1: Calculate the global mean R of the R channel, G channel and B channel of the white balance algorithm based on the white block method wb , G wb , and B wb , the expression is: Among them, ω i is the weight; S3.2: Calculate the white block gain K R_wb With the white block method gain K B_wb , the expression is: Among them, R wb is the global mean of the R channel, G wbis the global mean of the G channel, B wb is the global mean of the B channel.
[0009] Compared with the prior art, the present invention provides an improved method for adjusting image white balance, which has the following beneficial effects: The improved image white balance adjustment method provides an effective image white balance adjustment method by combining the global gray world method with the block statistical white block method. This method improves the white balance accuracy and visual effect while enhancing the robustness and processing efficiency of the algorithm. It is suitable for various high-resolution image processing devices. Compared with the traditional single white balance adjustment method, the present invention provides better performance and a wider range of application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 A schematic flow chart of an improved image white balance adjustment method proposed by the present invention; Figure 2 A schematic diagram of automatic white balance block calculation of an improved image white balance adjustment method proposed by the present invention; Figure 3 A schematic diagram of a white block area and a gray area of an improved image white balance adjustment method proposed by the present invention; Figure 4 This is a simulation schematic diagram of an automatic white balance algorithm for an improved image white balance adjustment method proposed by the present invention. DETAILED DESCRIPTION
[0011] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0012] See also Figure 1-4 , an improved image white balance adjustment method, comprising the following steps: S1: Divide the image into N blocks and calculate N for each image block i The mean R i , G i With B i , calculate each image block N i The weight ω i , for the weight ω i Perform normalized weighting to obtain image block N i The global statistical value R of the R channel arv_1024 and the global statistics value B of channel B arv_1024 , calculate the white balance gain K of the global grayscale worldR_global With K B_global , calculate the R channel gain K R With B channel gain K B ; S2: According to the R channel gain K R With B channel gain K B The number of white blocks in the image is calculated by multiplying the white balance gain parameter δ, and the number of white blocks Z is obtained by screening and eliminating. If the number of white blocks Z is ≤ 100, the process ends; otherwise, the process proceeds to step S3; S3: Calculate the global mean R of the R channel, G channel and B channel according to the calculated number of white blocks Z wb , G wb , and B wb , according to the global mean R wb , G wb , and B wb Calculate the white block gain K R_wb With the white block method gain K B_wb .
[0013] The specific steps of step S1 are: S1.1: Divide the image into N blocks, N = 32*32 = 1024 blocks, the size of each image block is 64*64, and calculate the N of each image block separately. i The average of the R channel, G channel and B channel is denoted as R i , G i With B i ; S1.2: For each image block N i The weights of the dark area and over-exposed area are suppressed, and each image block N is calculated. i The weight ω i , the expression is: S1.3: Calculate each image block N i The weight ω i After that, the weight ω i Perform normalized weighting to obtain image block N i The global statistical value R of the R channel arv_1024 and the global statistics value B of channel B arv_1024 , the expression is: Where N is the total number of image blocks; S1.4: Calculate the white balance gain K of the global grayscale world R_global With K B_global , the expression is: Among them, G is the global G channel grayscale mean; S1.5: According to the calculated white balance gain K R_global With K B_globa Get the R channel gain K R With B channel gain K B .
[0014] Step S2 is specifically as follows: Calculate the number of white blocks, the expression is: Among them, K R is the R channel gain, K B is the B channel gain, δ is the white balance gain product parameter, and σ is the tolerance parameter; When the image block N i The gray value G of the G channel i <30,>220, remove these image blocks N i ; The number of white blocks that meet the characteristics after screening and elimination is recorded as Z.
[0015] Step S3 is specifically as follows: S3.1: Calculate the global mean R of the R channel, G channel and B channel of the white balance algorithm based on the white block method wb , G wb , and B wb , the expression is: Among them, ω i is the weight; S3.2: Calculate the white block gain K R_wb With the white block method gain K B_wb , the expression is: Among them, R wb is the global mean of the R channel, G wb is the global mean of the G channel, B wb is the global mean of the B channel.
[0016] In general, when the number of white blocks detected in the image is greater than 100, the white block method is used for white balance adjustment. The specific reason is that the white block method adjusts the white balance by detecting the white area in the image, which is suitable for the situation where there is a clear white area in the image. The number of white blocks greater than 100 usually indicates that there is enough white area in the image. In this case, the white block method can provide more accurate and natural white balance adjustment. A large number of white blocks can effectively represent the true color of the image and reduce the interference of other colors on the white balance adjustment.
[0017] When the number of white blocks detected in the image is less than 100, the gray world method is used for white balance adjustment. The specific reason is that the gray world method is based on the overall color distribution assumption of the image and is suitable for situations where the white area in the image is insufficient or not obvious. The number of white blocks less than 100 usually indicates that the white area in the image is sparse or not obvious, and the effect of the white block method may not be ideal. At this time, the gray world method is used to adjust the overall gray value of the image to perform white balance correction, which can ensure that effective white balance adjustment can still be provided in the absence of sufficient white information.
[0018] The strategy of switching between the global grayscale world method based on block statistics and the white block method based on block statistics to adjust the white balance of the image can improve the accuracy, robustness, adaptability and processing efficiency of the algorithm. By dynamically selecting the appropriate algorithm according to the number of white blocks, the advantages of the white block method can be fully utilized when the white area is abundant, and the grayscale world method can be relied on for adjustment when the white area is insufficient, thereby improving the overall white balance accuracy; this strategy can effectively process images in various scenes, whether it is highlight or shadow area, the dynamic adjustment algorithm can cope with different lighting and color conditions, and enhance the robustness of the algorithm in complex environments; through real-time detection and dynamic switching, the algorithm can adapt to different image content and lighting conditions, so that it can provide high-quality white balance effects in various practical applications, avoiding the limitations of a single algorithm under specific conditions; the switching strategy uses the white block method with lower computational complexity when the white area is abundant, and selects the grayscale world method with strong adaptability when the white area is insufficient, which helps to optimize the utilization of computing resources in different scenes and improve processing efficiency.
[0019] Reference Figure 2-3 , the automatic white balance algorithm of the present invention is verified by software simulation. In order to ensure the accuracy of the test results, the automatic exposure gain module is turned off and the same exposure gain value is manually set to avoid the interference of the automatic gain on the performance of the white balance algorithm. The white balance algorithm processing results used by the previous camera are compared with the simulation results of the automatic white balance algorithm of the present invention.
[0020] Figure 2This is the result of the white balance algorithm of the previous camera. There may be obvious color deviation in the image, especially in complex lighting conditions or when there is insufficient white area, the white balance effect is poor; Figure 3 This is the simulation result of the automatic white balance algorithm of the present invention. The algorithm combines the global grayscale world method and the block statistical white block method, and can provide optimized white balance adjustment under different lighting conditions and white area richness. Therefore, the automatic white balance algorithm of the present invention is superior to the prior art in terms of accuracy and robustness of white balance adjustment. By combining the grayscale world method and the white block method, the algorithm can provide optimized white balance effects under various lighting conditions and different white areas. This improvement has significantly improved the quality of image processing and provided reliable guarantee for color accuracy and visual effects in practical applications.
[0021] Specific steps to obtain white balance gain product parameters: a: For different sensors, take pictures of 18% gray cards in different light sources in the light box, such as D75, D65, D50, CWF, TL84, A, H, etc., and then measure the R / G and B / G ratios of the 18% gray card area. Then use R / G and B / G as the horizontal and vertical coordinates, respectively, and plot the measured points on the coordinate axis to get the gray R / G and B / G ratios under different light sources; b: The white balance algorithm can create a gray zone based on these reference points to filter the statistics in a given scene. The gray zone is used to exclude interference from statistics of non-gray objects. A flexible gray zone can be established by assigning weights by the distance from the current point to the color temperature curve and defining the gray zone by the distance weight itself; c: When the camera takes a photo, it will process the image, divide the entire picture into M*N blocks, and calculate the basic information of each block, the number of white pixels and the mean of the R / G / B channel components. The idea of counting white points in the block is: set a color range, as long as it is within the range, it can be considered a white pixel. Of course, it is also necessary to remove extreme values: if there are too few white pixels in the block, they can be discarded; if there are too many white pixels, so many that every pixel has white pixels, they should also be discarded, because it is likely that the area is overexposed, and then the white pixel R / G / B is averaged to get the G / R, G / B values of the block.
[0022] The present invention combines the global grayscale world method based on block statistics and the white block method based on block statistics. This method divides the image into multiple blocks of size 64×64, performs statistics on the mean of the red, green and blue channels for each block, and weights these blocks according to the grayscale values of the pixels in the block. This weighted processing helps to reduce the interference of dark areas and overexposed areas on the final white balance calculation. This method not only overcomes the shortcomings of the existing technology, but also improves the accuracy, robustness and adaptability of white balance adjustment, providing better performance for various image capture and display devices. In summary, the improved image white balance adjustment method provides an effective image white balance adjustment method by combining the global gray world method and the block statistical white block method. This method improves the white balance accuracy and visual effect while enhancing the robustness and processing efficiency of the algorithm. It is suitable for various high-resolution image processing devices. Compared with the traditional single white balance adjustment method, the present invention provides better performance and a wider range of application scenarios.
[0023] It should be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0024] Although 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 appended claims and their equivalents.
Claims
1. An improved image white balance adjustment method, characterized in that: The following steps are involved: S1: Divide the image into N blocks and calculate N for each image block i The mean R i , G i With B i , calculate each image block N i The weight ω i , for the weight ω i Perform normalized weighting to obtain image block N i The global statistical value R of the R channel arv_1024 and the global statistics value B of channel B arv_1024 , calculate the white balance gain K of the global grayscale world R_global With K B_global , calculate the R channel gain K R With B channel gain K B ; S2: According to the R channel gain K R With B channel gain K B The number of white blocks in the image is calculated by multiplying the white balance gain parameter δ, and the number of white blocks Z is obtained by screening and eliminating. If the number of white blocks Z is ≤ 100, the process ends; otherwise, the process proceeds to step S3; S3: Calculate the global mean R of the R channel, G channel and B channel according to the calculated number of white blocks Z wb , G wb , and B wb , according to the global mean R wb , G wb , and B wb Calculate the white block gain K R_wb With the white block method gain K B_wb .
2. The improved image white balance adjustment method according to claim 1, characterized in that: The specific steps of step S1 are: S1.1: Divide the image into N blocks, N = 32*32 = 1024 blocks, the size of each image block is 64*64, and calculate the N of each image block separately. i The average of the R channel, G channel and B channel is denoted as R i , G i With B i ; S1.2: For each image block N i The weights of the dark area and over-exposed area are suppressed, and each image block N is calculated. i The weight ω i , the expression is: S1.3: Calculate each image block N i The weight ω i After that, the weight ω i Perform normalized weighting to obtain image block N i The global statistical value R of the R channel arv_1024 and the global statistics value B of channel B arv_1024 , the expression is: Where N is the total number of image blocks; S1.4: Calculate the white balance gain K of the global grayscale world R_global With K B_global , the expression is: Among them, G is the global G channel grayscale mean; S1.5: According to the calculated white balance gain K R_global With K B_globa Get the R channel gain K R With B channel gain K B .
3. The improved image white balance adjustment method according to claim 1, characterized in that: The step S2 is specifically as follows: Calculate the number of white blocks, the expression is: Among them, K R is the R channel gain, K B is the B channel gain, δ is the white balance gain product parameter, and σ is the tolerance parameter; When the image block N i The gray value G of the G channel i <30,>220, remove these image blocks N i ; The number of white blocks that meet the characteristics after screening and elimination is recorded as Z.
4. The improved image white balance adjustment method according to claim 1, characterized in that: Step S3 is specifically as follows: S3.1: Calculate the global mean R of the R channel, G channel and B channel of the white balance algorithm based on the white block method wb , G wb , and B wb , the expression is: Among them, ω i is the weight; S3.2: Calculate the white block gain K R_wb With the white block method gain K B_wb , the expression is: Among them, R wb is the global mean of the R channel, G wb is the global mean of the G channel, B wb is the global mean of the B channel.