Color Balance Correction Method, Device, Electronic Device and Storage Medium

By calculating the gradient value and feature value of the pixel to be corrected, and performing multiple predictions and combinations, the color imbalance problem caused by sensor crosstalk is solved, and the accuracy of color correction and image quality is improved.

CN115988188BActive Publication Date: 2025-07-29AXERA SEMICON (SHANGHAI) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211718226.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-29
Publication Date
2025-07-29
Estimated Expiration
2042-12-29

AI Technical Summary

Technical Problem

The prior art has the problem of color imbalance caused by sensor crosstalk in correcting images, which has insufficient accuracy, which may lead to poor image resolution.

Method used

By determining the pixel to be corrected and the same color pixels that are not in the same channel and are not in the same channel, multiple gradient values and eigenvalues are calculated, and multiple predictions and combinations of color balance correction values are performed, and correction accuracy is improved using filtering processing and weighted averaging.

Benefits of technology

Improves the accuracy of color balance correction, improves image quality, especially the balance between green pixel channels, and reduces grid-like defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115988188B_ABST
    Figure CN115988188B_ABST
Patent Text Reader

Abstract

The present application provides a color balance correction method, apparatus, electronic device, and storage medium. Among them, the method includes: determining a first color pixel and a second color pixel corresponding to a pixel to be corrected, where the first color pixel is a pixel in the same channel as the pixel to be corrected, and the second color pixel is a pixel of the same color as the pixel to be corrected but not in the same channel; calculating a plurality of gradient values of the pixel to be corrected at the current position according to the first color pixel; calculating a plurality of eigenvalue of a plurality of second color pixels according to the second color pixel; calculating a color balance correction value of the pixel to be corrected according to the plurality of gradient values and the plurality of eigenvalue, so as to perform color balance correction on the pixel to be corrected through the color balance correction value. The embodiments of the present application can make multiple predictions on the correction value of the pixel to be corrected according to the plurality of gradient values and the plurality of eigenvalue, and obtain the color balance correction value based on the plurality of gradient values and the plurality of eigenvalue, which can improve the accuracy of the color balance correction value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing, and in particular, to a color balance correction method, device, electronic device, and storage medium. Background Art

[0002] Due to the crosstalk phenomenon inside the sensor, that is, the light of adjacent pixels leaks to the current pixel in a certain way, which affects the pixel value of the current pixel. Affected by the manufacturing process of the sensor, the degree of leakage of the above light is different in the horizontal and vertical directions, and thus the same-color pixels will have different performances for the same light source, so in the final image, grid-like defects will appear on the image, resulting in serious image quality problems.

[0003] Currently, the common practice to overcome the above problems is to analyze and correct the crosstalk, thereby alleviating the problem of color imbalance. Or use the analysis of the graph of the image to manually judge whether there is color imbalance, and then perform corresponding correction. However, the causes of crosstalk are very complex and involve various factors such as lenses, sensors, and light sources. Therefore, correcting color imbalance by analyzing the degree of crosstalk is relatively inaccurate. And correcting color imbalance by means of image analysis cannot determine whether the different performances of the same-color pixels on the image are due to the problem of color imbalance or really due to the problem of the texture itself. If misjudgment occurs, problems such as poor image resolution may be caused. Summary of the Invention

[0004] In view of this, the purpose of the embodiments of the present application is to provide a color balance correction method, device, electronic device, and readable storage medium, which can improve the accuracy of the color balance correction value, and further improve the accuracy of color imbalance correction.

[0005] In a first aspect, the embodiments of the present application provide a color balance correction method, including: determining a first color pixel and a second color pixel corresponding to a pixel to be corrected, where the first color pixel is a pixel in the same channel as the pixel to be corrected, and the second color pixel is a same-color pixel not in the same channel as the pixel to be corrected; calculating a plurality of gradient values of the pixel to be corrected at the current position according to the first color pixel; calculating a plurality of feature values of the plurality of second color pixels according to the second color pixel; calculating a color balance correction value of the pixel to be corrected according to the plurality of gradient values and the plurality of feature values, so as to perform color balance correction on the pixel to be corrected through the color balance correction value.

[0006] In the above implementation process, by calculating multiple gradient values based on the first color pixels and multiple eigenvalue based on the second color pixels, multiple predictions are made for the correction value of the pixel to be corrected through the multiple gradient values and multiple eigenvalue, and based on the color balance correction value obtained from the multiple gradient values and multiple eigenvalue, the accuracy of the color balance correction value can be improved, thereby improving the accuracy of color balance correction.

[0007] In one embodiment, calculating the color balance correction value of the pixel to be corrected according to the multiple gradient values and the multiple eigenvalue, and performing color balance correction on the pixel to be corrected through the color balance correction value includes: arranging and combining the multiple gradient values and the multiple eigenvalue and then adding them to obtain an estimated value of the second color pixel; calculating the color balance correction value of the pixel to be corrected according to the estimated value of the second color pixel and the pixel value of the pixel to be corrected, and performing color balance correction on the pixel to be corrected through the color balance correction value.

[0008] In the above implementation process, by arranging and combining multiple gradient values and multiple eigenvalue, multiple estimated values of the second color pixel are obtained, and multiple predictions can be made for the correction value of the pixel to be corrected, improving the accuracy of the prediction of the correction value of the pixel to be corrected.

[0009] In one embodiment, calculating the color balance correction value of the pixel to be corrected according to the estimated value of the second color pixel and the pixel value of the pixel to be corrected, and performing color balance correction on the pixel to be corrected through the color balance correction value includes: performing filtering processing on the estimated value of the second color pixel and the pixel value of the pixel to be corrected to obtain a final estimated value of the second color pixel; performing weighted average processing on the final estimated value of the second color pixel and the pixel value of the pixel to be corrected to obtain the color balance correction value of the pixel to be corrected, and performing color balance correction on the pixel to be corrected through the color balance correction value.

[0010] In the above implementation process, after determining the estimated value of the second color pixel, filtering processing is performed on the estimated value of the second color pixel to eliminate interference, thereby improving the accuracy of the final estimated value of the second color pixel. Then, by performing weighted average on the final estimated value of the second color pixel and the pixel value of the pixel to be corrected, the difference between the pixel to be corrected and the second color pixel is balanced, improving the accuracy of color balance correction of the pixel to be corrected.

[0011] In one embodiment, if the pixel to be corrected is an edge pixel of the target window, before determining the first color pixel and the second color pixel corresponding to the pixel to be corrected, the method further includes: taking the axis where the edge pixel adjacent to the pixel to be corrected is located as the central axis, and mirror-complementing the pixels on the blank side of the pixel to be corrected through the pixels on the pixel side where the pixel to be corrected is located.

[0012] In the above implementation process, for the pixel to be corrected at the edge of the target window, before calculating the color balance correction value, the pixels on the blank side are first mirror-complemented through the pixels on the pixel side, so that when calculating the pixel to be corrected, multiple predictions can be made on the correction value of the pixel to be corrected according to multiple pixels in the target window, which can improve the accuracy of the color balance correction value.

[0013] In one embodiment, the pixel to be corrected is a green pixel.

[0014] In the above implementation process, since there are two channels for green pixels in each pixel, and the pixel values of these two green pixel channels are different due to different horizontal and vertical proximities, which causes the imbalance of green pixels in the two channels. By calculating the color balance correction value for this green pixel, the green balance correction is performed on the green pixel through this color balance correction value, balancing the pixel difference between the green pixels in the two channels and improving the image quality.

[0015] In one embodiment, calculating multiple gradient values of the pixel to be corrected at the current position according to the first color pixel includes: calculating multiple gradient values of the pixel to be corrected at the current position according to some of the first color pixels in the first color pixel.

[0016] In the above implementation process, by calculating multiple gradient values of the pixel to be corrected at the current position according to some of the first color pixels in the first color pixel, multiple possibilities for calculating the gradient value are increased to obtain more gradient values. Through multiple gradient values, multiple predictions can be made on the correction value of the pixel to be corrected, improving the accuracy of predicting the correction value of the pixel to be corrected.

[0017] In one embodiment, calculating the feature values of multiple second color pixels according to the second color pixel includes: calculating the feature values of multiple second color pixels according to some of the second color pixels in the second color pixel.

[0018] In the above implementation process, by calculating the feature values of multiple second color pixels according to some of the second color pixels in the second color pixel, multiple possibilities for calculating the feature value are increased to obtain more feature values. Through multiple feature values, multiple predictions can be made on the correction value of the pixel to be corrected, improving the accuracy of predicting the correction value of the pixel to be corrected.

[0019] In a second aspect, an embodiment of the present application further provides a color balance correction device, including: a determination module configured to determine a first color pixel and a second color pixel corresponding to a pixel to be corrected, where the first color pixel is a pixel in the same channel as the pixel to be corrected, and the second color pixel is a pixel of the same color as the pixel to be corrected but not in the same channel; a first calculation module configured to calculate a plurality of gradient values of the pixel to be corrected at the current position according to the first color pixel; a second calculation module configured to calculate feature values of a plurality of the second color pixels according to the second color pixels; and a third calculation module configured to calculate a color balance correction value of the pixel to be corrected according to the plurality of gradient values and the plurality of feature values, so as to perform color balance correction on the pixel to be corrected through the color balance correction value.

[0020] In a third aspect, an embodiment of the present application further provides an electronic device, including: a processor and a memory, where the memory stores machine-readable instructions executable by the processor, and when the electronic device runs, the machine-readable instructions, when executed by the processor, perform the steps of the method in the first aspect or any possible implementation manner of the first aspect.

[0021] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is run by a processor, it performs the steps of the color balance correction method in the first aspect or any possible implementation manner of the first aspect.

[0022] To make the above objects, features, and advantages of the present application more obvious and understandable, specific embodiments are hereinafter given, and in conjunction with the accompanying drawings, the detailed description is as follows. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] To more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required to be used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.

[0024] Figure 1 It is a schematic diagram of the distribution of color pixels in every 2x2 pixels provided by an embodiment of the present application;

[0025] Figure 2 It is a flowchart of the color balance correction method provided by an embodiment of the present application;

[0026] Figure 3 It is a schematic diagram of the distribution of color pixels in 5x5 pixels provided by an embodiment of the present application;

[0027] Figure 4 Schematic diagram of the distribution of color pixels in 4x6 pixels provided by the embodiment of the present application;

[0028] Figure 5 The image after mirror filling when the pixel to be corrected is Gb01 in the schematic diagram of the distribution of color pixels in 4x6 pixels provided by the embodiment of the present application;

[0029] Figure 6 The image after mirror filling when the pixel to be corrected is Gr06 in the schematic diagram of the distribution of color pixels in 4x6 pixels provided by the embodiment of the present application;

[0030] Figure 7 Schematic diagram of the distribution of color pixels in 10x10 pixels provided by the embodiment of the present application;

[0031] Figure 8 Schematic diagram of the functional modules of the color balance correction device provided by the embodiment of the present application;

[0032] Figure 9 Block diagram of the electronic device provided by the embodiment of the present application. Detailed implementation manners

[0033] Next, the technical solutions in the embodiments of the present application will be described with reference to the accompanying drawings in the embodiments of the present application.

[0034] It should be noted that similar reference numerals and letters denote similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of the present application, the terms "first", "second", etc. are only used for distinguishing descriptions and cannot be construed as indicating or implying relative importance.

[0035] For the convenience of understanding, the applicable scenarios of the embodiments of the present application will be elaborated in detail first.

[0036] In order to increase the photosensitivity of a single pixel, the image sensor of a camera usually adopts a Bayer Pattern (Chinese name: Bayer array) structure. That is, through an optical mask, each pixel of the image only receives light of a certain wavelength among red, green, and blue. Therefore, each pixel of the output image of the image sensor can also be divided into three types: red, green, and blue. Also, because in natural light, the human eye is more sensitive to green light, the proportion of green pixels in the Bayer Pattern is twice that of red and blue. As a result, in the output of the image sensor, every 2x2 pixels appear in a form similar to Figure 1 in this form, Figure 1Among them, R is the red pixel, B is the blue pixel, Gr is the green pixel, its horizontal neighbor is the red pixel, and its vertical neighbor is the blue pixel; Gb is the green pixel, its horizontal neighbor is the blue pixel, and its vertical neighbor is the red pixel.

[0037] It can be found from Figure 1 that Gr and Gb are both green pixels, but their horizontal and vertical neighbors are different. Obviously, Gr is crosstalked by R horizontally and by B vertically. Gb is crosstalked by B horizontally and by R vertically. Based on such differences, Gr and Gb, which are both green pixels, have different performances for the same light source, that is, different pixel values.

[0038] If such Gr and Gb are spread all over the image, when the performances of these two kinds of pixels are different, in the final imaging, grid-like defects will appear on the image, causing serious image quality problems. This problem is color imbalance.

[0039] In view of this, the inventor of the present application proposes a color balance correction method. By calculating multiple gradient values of the pixel to be corrected at the current position according to the pixels in the same channel as the pixel to be corrected, and calculating multiple eigenvalue of multiple second color pixels according to the same-color pixels not in the same channel as the pixel to be corrected, and making multiple predictions on the correction value of the pixel to be corrected through the multiple eigenvalues and gradient values, and then integrating these multiple predictions, a more accurate color balance correction value can be obtained, and the color imbalance can be corrected through the color balance correction value, improving the image quality.

[0040] Please refer to Figure 2 , which is a flowchart of the color balance correction method provided by the embodiment of the present application. The following will elaborate on the Figure 2 specific process shown in detail.

[0041] Step 201, determine the first color pixel and the second color pixel corresponding to the pixel to be corrected.

[0042] Among them, the first color pixel is the pixel in the same channel as the pixel to be corrected, and the second color pixel is the same-color pixel not in the same channel as the pixel to be corrected.

[0043] In the currently commonly used Bayer Pattern structure, the proportion of green pixels is twice that of red and blue. Therefore, in the output of the image sensor, among every 2×2 pixels, there are two green pixel channels. Because the horizontal and vertical proximities of these two green pixel channels are different, their pixel values are different, and then the green pixels in the two channels are unbalanced. Any green pixel in these two channels can be the pixel to be corrected.

[0044] The same channel here refers to a channel with the same crosstalk in the horizontal and vertical directions. Taking the BayerPattern structure as an example, the relationship between the pixel to be corrected, the first pixel, and the second pixel will be further described with reference to the drawings. As Figure 3 shown, Figure 3 in, Gr00, Gr02, Gr04, Gr20, Gr22, Gr24, Gr40, Gr42, and Gr44 are pixels in the same channel, and Gb11, Gb13, Gb31, and Gb33 are pixels in the same channel.

[0045] Exemplarily, if the pixel to be corrected is Gr22, the first color pixels are Gr00, Gr02, Gr04, Gr20, Gr24, Gr40, Gr42, and the second color pixels are Gb11, Gb13, Gb31, Gb33. If the pixel to be corrected is Gb11, the first color pixels are Gb13, Gb31, Gb33, and the second color pixels are Gr00, Gr02, Gr04, Gr20, Gr24, Gr40, Gr42.

[0046] The above-mentioned first color pixels and second color pixels are all color pixels within the image window.

[0047] It can be understood that in addition to the commonly used Bayer Pattern structure, there is also the sensor structure. In the sensor structure, the proportion of yellow pixels is twice that of red and blue. Therefore, in the output of the image sensor, for every 2×2 pixels, there are two yellow pixel channels. Then the pixel to be corrected in this structure is a yellow pixel.

[0048] The above-mentioned pixel to be corrected being a yellow pixel or a green pixel is only exemplary. The determination of the pixel to be corrected can be determined according to the structure of the image sensor, and the present application does not make specific limitations.

[0049] Step 202, calculate multiple gradient values of the pixel to be corrected at the current position according to the first color pixels.

[0050] The multiple gradient values here can be calculated by operators such as the Sobel operator and the Laplace operator.

[0051] Exemplarily, as Figure 3 shown, if Figure 3 in the pixel to be corrected is Gr22, then the following method can be used to calculate multiple gradient values by the first color pixels:

[0052] Gr_Grad_1 = Gr22 - (Gr02 + Gr20 + Gr24 + Gr42) / 4.0;

[0053] Gr_Grad_2 = Gr22 - (Gr00 + Gr04 + Gr040 + Gr44) / 4.0;

[0054] Among them, Gr_Grad_1 is the first gradient value, Gr_Grad_2 is the second gradient value, and Gr00, Gr02, Gr04, Gr20, Gr22, Gr24, Gr40, Gr42, Gr44 are the pixel values of each pixel.

[0055] Of course, in addition to the above algorithm, the following method can also be used to calculate multiple gradient values through the first color pixel:

[0056] Gr_Grad_3 = Gr22 - (Gr20 + Gr24) / 2.0;

[0057] Gr_Grad_4 = Gr22 - (Gr02 + Gr42) / 2.0;

[0058] Among them, Gr_Grad_3 is the third gradient value, Gr_Grad_4 is the fourth gradient value, and Gr02, Gr20, Gr22, Gr24, Gr42 are the pixel values of each pixel.

[0059] It can be understood that the above algorithm for calculating multiple gradient values through the first color pixel is only exemplary, and the calculation method for calculating multiple gradient values through the first color pixel can be adjusted according to the actual situation, and this application does not make specific restrictions.

[0060] Step 203, calculate multiple eigenvalue of multiple second color pixels according to the second color pixel.

[0061] These multiple eigenvalue can be calculated by methods such as average value, weighted average value, average value in a certain direction, etc.

[0062] Exemplarily, as Figure 3 shown, if Figure 3 the pixel to be corrected in is Gr22, then the following method can be used to calculate multiple eigenvalue through the second color pixel:

[0063] Gb_Val_1 = (Gb11 + Gb13 + Gb31 + Gb33) / 4.0;

[0064] Gb_Val_2 = (Gb11 + Gb33) / 2.0;

[0065] Gb_Val_3 = (Gb31 + Gb13) / 2.0;

[0066] Among them, Gb_Val_1 is the first eigenvalue, Gb_Val_2 is the second eigenvalue, Gb_Val_3 is the third eigenvalue, and Gb11, Gb13, Gb31, and Gb33 are the pixel values of each pixel.

[0067] Of course, in addition to the above method, the following method can also be used to calculate multiple eigenvalues through the second color pixel:

[0068] Gb_Val_4 = Medium_Filter(Gb11, Gb13 + Gb31 + Gb33);

[0069] Gb_Val_5 = Max((Gb11 + Gb33) / 2.0, (Gb31 + Gb13) / 2.0);

[0070] Among them, Gr_Grad_4 is the fourth eigenvalue, Gr_Grad_5 is the fifth eigenvalue, and Gb11, Gb13, Gb31, and Gb33 are the pixel values of each pixel.

[0071] It can be understood that the above algorithm for calculating multiple eigenvalues through the second color pixel is only exemplary, and the calculation method for calculating multiple eigenvalues through the second color pixel can be adjusted according to the actual situation, and the present application does not make specific restrictions.

[0072] Step 204, calculate the color balance correction value of the pixel to be corrected according to the multiple gradient values and multiple eigenvalues, so as to perform color balance correction on the pixel to be corrected through the color balance correction value.

[0073] The color balance correction value here is the corrected pixel value of the pixel to be corrected. Exemplarily, if the color balance correction value is A, then the pixel value of the pixel to be corrected can be replaced by this color balance correction value, that is, the corrected pixel value of the pixel to be corrected is also A.

[0074] In the above implementation process, by calculating multiple gradient values according to the first color pixel and multiple eigenvalues according to the second color pixel, so as to make multiple predictions on the correction value of the pixel to be corrected through the multiple gradient values and multiple eigenvalues, and based on the color balance correction value obtained from the multiple gradient values and multiple eigenvalues, the accuracy of the color balance correction value can be improved, and thus the accuracy of color balance correction can be improved.

[0075] In a possible implementation manner, step 204 includes: arranging and combining the multiple gradient values and multiple eigenvalues and then adding them to obtain an estimated value of the second color pixel; calculating the color balance correction value of the pixel to be corrected according to the estimated value of the second color pixel and the pixel value of the pixel to be corrected, so as to perform color balance correction on the pixel to be corrected through the color balance correction value.

[0076] Understandably, if there are M gradient values and N eigenvalue values, then M×N estimated values of the second color pixels can be obtained.

[0077] Exemplarily, if the gradient values include: the first gradient value Gr_Grad_1 and the second gradient value Gr_Grad_2. The eigenvalue values include: the first eigenvalue Gb_Val_1, the second eigenvalue Gb_Val_2, and the third eigenvalue Gb_Val_3. Then, by arranging and combining the 2 gradient values and 3 eigenvalue values and adding them together, the following 6 estimated values of the second color pixels can be obtained:

[0078] Gb_Est_1 = Gr_Grad_1 + Gb_Val_1;

[0079] Gb_Est_2 = Gr_Grad_1 + Gb_Val_2;

[0080] Gb_Est_3 = Gr_Grad_1 + Gb_Val_3;

[0081] Gb_Est_4 = Gr_Grad_2 + Gb_Val_1;

[0082] Gb_Est_5 = Gr_Grad_2 + Gb_Val_2;

[0083] Gb_Est_6 = Gr_Grad_2 + Gb_Val_3;

[0084] Among them, Gb_Est_1, Gb_Est_2, Gb_Est_3, Gb_Est_4, Gb_Est_5, and Gb_Est_6 are all estimated values of the second color pixels.

[0085] In the above implementation process, by arranging and combining multiple gradient values and multiple eigenvalue values to obtain multiple estimated values of the second color pixels, multiple predictions can be made for the correction value of the pixel to be corrected, improving the accuracy of predicting the correction value of the pixel to be corrected.

[0086] In a possible implementation manner, according to the estimated value of the second color pixel and the pixel value of the pixel to be corrected, calculate the color balance correction value of the pixel to be corrected, so as to perform color balance correction on the pixel to be corrected through the color balance correction value, including: performing filtering processing on the estimated value of the second color pixel and the pixel value of the pixel to be corrected to obtain the final estimated value of the second color pixel; performing weighted average processing on the final estimated value of the second color pixel and the pixel value of the pixel to be corrected to obtain the color balance correction value of the pixel to be corrected, so as to perform color balance correction on the pixel to be corrected through the color balance correction value.

[0087] The filtering process here can be low-pass filtering, median filtering, maximum filtering, minimum filtering, etc. This filtering method can be selected according to the actual situation, and the present application does not make specific limitations.

[0088] Exemplarily, if median filtering is performed on the estimated value of the second color pixel and the pixel to be corrected in the above example, the following results can be obtained:

[0089] Gb_Est = Median_Filter(Gr22, Gb_Est_1, Gb_Est_2, Gb_Est_3, Gb_Est_4, Gb_Est_5, Gb_Est_6);

[0090] Among them, Gb_Est is the final estimated value of the second color pixel, Gb_Est_1, Gb_Est_2, Gb_Est_3, Gb_Est_4, Gb_Est_5, and Gb_Est_6 are all estimated values of the second color pixel, and Gr22 is the pixel value of the pixel to be corrected.

[0091] After median filtering the estimated value of the second color pixel and the pixel to be corrected, the final estimated value of the second color pixel and the pixel value of the pixel to be corrected are weighted and averaged to obtain the color balance correction value of the pixel to be corrected. The example is as follows:

[0092] Gr22_GIC = (Gb_Est + Gr22) / 2.0;

[0093] Among them, Gr22_GIC is the color balance correction value of the pixel to be corrected, Gb_Est is the final estimated value of the second color pixel, and Gr22 is the pixel value of the pixel to be corrected.

[0094] In the above implementation process, after determining the estimated value of the second color pixel, filtering processing is performed on the estimated value of the second color pixel to eliminate interference, thereby improving the accuracy of the final estimated value of the second color pixel. Then, by weighting and averaging the final estimated value of the second color pixel and the pixel value of the pixel to be corrected, the difference between the pixel to be corrected and the second color pixel is balanced, and the accuracy of the color balance correction of the pixel to be corrected is improved.

[0095] In a possible implementation manner, if the pixel to be corrected is an edge pixel of the target window, before step 201, the method further includes: taking the axis where the edge pixel adjacent to the pixel to be corrected is located as the central axis, and mirror-complementing the pixels on the blank side of the pixel to be corrected with the pixels on the pixel side of the pixel to be corrected.

[0096] The target window here is the image window of the displayed image.

[0097] Understandably, if the pixel to be corrected is an edge pixel of the target window, then there are no color pixels on at least one side of the pixel to be corrected horizontally or vertically. To ensure that the calculated color balance correction value of the pixel to be corrected is more accurate, the side without color pixels can be mirror-complemented according to the existing color pixels.

[0098] Exemplarily, as Figure 4 shown, if the pixel to be corrected is Figure 4 Gb01 in, there are no color pixels on the left and upper sides of this Gb01. The edge pixel adjacent to the pixel to be corrected is the pixel to be corrected. Then, horizontally, the column where the pixel point where Gb01 is located can be used as the central axis, and the right color pixels can be mirror-complemented to the left. And horizontally, the row where the pixel point where Gb01 is located can be used as the central axis, and the lower color pixels can be mirror-complemented to the upper side. After forming the image as Figure 5 shown, the color balance correction value of this Gb01 is calculated according to steps 201-204.

[0099] If the pixel to be corrected is Figure 4 Gr06 in, there are no color pixels on the left side of this Gr06. The edge pixel adjacent to the pixel to be corrected is the black pixel on the left side of Gr06. Then, horizontally, the column where the black pixel on the left side of Gr06 is located can be used as the central axis, and the right color pixels can be mirror-complemented to the left. After forming the image as Figure 6 shown, the color balance correction value of this Gr06 is calculated according to steps 201-204.

[0100] Understandably, the above is only exemplary. The method of mirror-complementing the pixels on the blank side of the pixel to be corrected through the pixels on the side with pixels can be adjusted according to the position of the pixel to be corrected and the distribution of the actual color pixels. The present application does not make specific limitations.

[0101] In the above implementation process, for the pixels to be corrected at the edge of the target window, before calculating the color balance correction value, the pixels on the blank side are first mirror-complemented through the pixels on the side with pixels, so that when calculating the pixels to be corrected, multiple predictions can be made on the correction value of the pixels to be corrected according to multiple pixels in the target window, which can improve the accuracy of the color balance correction value.

[0102] In a possible implementation manner, the pixel to be corrected is a green pixel.

[0103] In the above implementation process, since there are two channels for green pixels in each pixel, and the pixel values of these two green pixel channels are different due to different horizontal and vertical proximities, it results in an imbalance in green pixels between the two channels. By applying a color balance correction value to the green pixels, the green balance correction of the green pixels is performed through this color balance correction value, balancing the pixel difference between the green pixels of the two channels and improving the image quality.

[0104] In a possible implementation manner, step 202 includes: calculating multiple gradient values of the pixel to be corrected at the current position according to some of the first color pixels in the first color pixels.

[0105] It can be understood that for the multiple first color pixels corresponding to the pixel to be corrected, when calculating the gradient value through the first color pixels, the gradient value can be calculated through all the first color pixels in the target window, or only through some of the first color pixels in the target window.

[0106] Exemplarily, as Figure 3 shown, if the pixel to be corrected is Gr22, the gradient value of Gr22 at the current position can be calculated through Gr00, Gr02, Gr04, Gr20, Gr24, Gr40, Gr42, Gr44. The gradient value of Gr22 at the current position can also be calculated through Gr00, Gr02, Gr04, Gr40, Gr42, Gr44, and the horizontal gradient value of Gr22 at the current position can be calculated through Gr00, Gr02, Gr04, Gr40, Gr42, Gr44. The gradient value of Gr22 at the current position can also be calculated through Gr00, Gr20, Gr40, Gr04, Gr24, Gr44, and the vertical gradient value of Gr22 at the current position can be calculated through Gr00, Gr20, Gr40, Gr04, Gr24, Gr44. Of course, the gradient value of Gr22 at the current position can also be calculated through Gr04, Gr40, Gr00, Gr44, and the gradient value of Gr22 at the 45° angle at the current position can be calculated through Gr04, Gr40, Gr00, Gr44, etc.

[0107] The above calculation of multiple gradient values of the pixel to be corrected through the first color pixels can be performed through the first color pixels adjacent to the pixel to be corrected, or through the first color pixels not adjacent to the pixel to be corrected. The selection of the first color pixels can be adjusted according to the actual situation, and the present application does not make specific limitations.

[0108] Exemplarily, as Figure 7As shown, if the pixel to be corrected is Gr113, the gradient values can be calculated by selecting Gr100, Gr104, Gr121, Gr125, or the gradient values can be calculated by selecting Gr106, Gr108, Gr1117, Gr1119, etc.

[0109] In the above implementation process, by calculating multiple gradient values of the pixel to be corrected at the current position according to some of the first color pixels in the first color pixels, various possibilities for calculating the gradient values are increased to obtain more gradient values. Through multiple gradient values, various predictions can be made for the correction value of the pixel to be corrected, improving the accuracy of predicting the correction value of the pixel to be corrected.

[0110] In a possible implementation manner, step 203 includes: calculating the eigenvalue of multiple second color pixels according to some of the second color pixels in the second color pixels.

[0111] It can be understood that for the multiple second color pixels corresponding to the pixel to be corrected, when calculating the eigenvalue through the second color pixels, the eigenvalue can be calculated through all the second color pixels in the target window, or only through some of the second color pixels in the target window.

[0112] Exemplarily, as Figure 7 shown, if the pixel to be corrected is Gr113, the eigenvalue of the second color pixels can be calculated by Gb107, Gb108, Gb112, Gb113. The eigenvalue of the second color pixels can also be calculated by Gb102, Gb107, Gb112, Gb117, Gb122. Through Gb102, Gb107, Gb112, Gb117, Gb122, the longitudinal eigenvalue of the second color pixels can be calculated. The eigenvalue of the second color pixels can also be calculated by Gb105, Gb106, Gb107, Gb108, Gb109. Through Gb105, Gb106, Gb107, Gb108, Gb109, the transverse eigenvalue of the second color pixels can be calculated. Of course, the eigenvalue of the second color pixels can also be calculated by Gb104, Gb108, Gb112, Gb116, Gb120. Through Gb104, Gb108, Gb112, Gb116, Gb120, the 45°-angle eigenvalue of the second color pixels can be calculated, etc.

[0113] The above calculation of the eigenvalue of the second color pixels through the second color pixels can be performed by using the second color pixels adjacent to the pixel to be corrected, or by using the second color pixels not adjacent to the pixel to be corrected. The selection of the second color pixels can be adjusted according to the actual situation, and the present application does not make specific limitations.

[0114] Exemplarily, as Figure 7 shown, if the pixel to be corrected is Gr113, the eigenvalues can be calculated by selecting Gb107, Gb108, Gb112, Gb113, or the eigenvalues can be calculated by selecting Gb100, Gb104, Gb120, Gb124, etc.

[0115] In the above implementation process, by calculating the eigenvalues of multiple second color pixels based on some of the second color pixels in the second color pixels, various possibilities for calculating the eigenvalues are increased to obtain more eigenvalues. Multiple eigenvalues can be used to make various predictions on the correction value of the pixel to be corrected, improving the accuracy of predicting the correction value of the pixel to be corrected.

[0116] Based on the same inventive concept, an embodiment of the present application also provides a color balance correction device corresponding to the color balance correction method. Since the principle of solving problems by the device in the embodiment of the present application is similar to that of the foregoing color balance correction method embodiment, the implementation of the device in this embodiment can refer to the description in the embodiment of the above method, and the repeated parts will not be elaborated.

[0117] Please refer to Figure 8 , which is a schematic diagram of the functional modules of the color balance correction device provided by the embodiment of the present application. Each module in the color balance correction device in this embodiment is used to execute each step in the above method embodiment. The color balance correction device includes a determination module 301, a first calculation module 302, a second calculation module 303, and a third calculation module 304; wherein,

[0118] The determination module 301 is used to determine the first color pixel and the second color pixel corresponding to the pixel to be corrected. The first color pixel is the pixel in the same channel as the pixel to be corrected, and the second color pixel is the same-color pixel not in the same channel as the pixel to be corrected.

[0119] The first calculation module 302 is used to calculate multiple gradient values of the pixel to be corrected at the current position according to the first color pixel.

[0120] The second calculation module 303 is used to calculate the eigenvalues of multiple second color pixels according to the second color pixels.

[0121] The third calculation module 304 is used to calculate the color balance correction value of the pixel to be corrected according to multiple gradient values and multiple eigenvalues, so as to perform color balance correction on the pixel to be corrected through the color balance correction value.

[0122] In a possible implementation, the third calculation module 304 is further configured to: arrange and combine the multiple gradient values and multiple eigenvalue to obtain an estimated value of the second color pixel; calculate a color balance correction value of the pixel to be corrected according to the estimated value of the second color pixel and the pixel value of the pixel to be corrected, so as to perform color balance correction on the pixel to be corrected through the color balance correction value.

[0123] In a possible implementation, the third calculation module 304 is specifically configured to: perform filtering processing on the estimated value of the second color pixel and the pixel value of the pixel to be corrected to obtain a final estimated value of the second color pixel; perform weighted average processing on the final estimated value of the second color pixel and the pixel value of the pixel to be corrected to obtain a color balance correction value of the pixel to be corrected, so as to perform color balance correction on the pixel to be corrected through the color balance correction value.

[0124] In a possible implementation, the color balance correction device further includes a filling module, configured to: take the axis where the edge pixel adjacent to the pixel to be corrected is located as the central axis, and mirror and fill the pixels on the blank side of the pixel to be corrected with the pixels on the side where the pixel to be corrected has pixels.

[0125] In a possible implementation, the first calculation module 302 is specifically configured to: calculate multiple gradient values of the pixel to be corrected at the current position according to some of the first color pixels in the first color pixel.

[0126] In a possible implementation, the second calculation module 303 is specifically configured to: calculate eigenvalues of multiple second color pixels according to some of the second color pixels in the second color pixel.

[0127] For ease of understanding of this embodiment, the electronic device that executes the color balance correction method disclosed in the embodiments of the present application will be introduced in detail below.

[0128] As Figure 9 shown, it is a block diagram of an electronic device. The electronic device 100 may include a memory 111 and a processor 113. Those of ordinary skill in the art can understand that Figure 9 the structure shown is only for illustration, and it does not limit the structure of the electronic device 100. For example, the electronic device 100 may further include more or fewer components than Figure 9 shown, or have a different configuration from Figure 9 shown.

[0129] The above-mentioned memory 111 and processor 113 are electrically connected directly or indirectly to each other to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines. The above-mentioned processor 113 is used to execute the executable module stored in the memory.

[0130] Among them, the memory 111 can be, but is not limited to, a random access memory (Random Access Memory, abbreviated as RAM), a read-only memory (Read Only Memory, abbreviated as ROM), a programmable read-only memory (Programmable Read-Only Memory, abbreviated as PROM), an erasable programmable read-only memory (Erasable Programmable Read-Only Memory, abbreviated as EPROM), an electrically erasable programmable read-only memory (Electric Erasable Programmable Read-Only Memory, abbreviated as EEPROM), etc. Among them, the memory 111 is used to store a program. After receiving an execution instruction, the processor 113 executes the program. The method executed by the electronic device 100 defined by the process disclosed in any embodiment of the present application can be applied to the processor 113 or implemented by the processor 113.

[0131] The above-mentioned processor 113 may be an integrated circuit chip with signal processing capabilities. The above-mentioned processor 113 can be a general-purpose processor, including a central processing unit (Central Processing Unit, abbreviated as CPU), a network processor (Network Processor, abbreviated as NP), etc.; it can also be a digital signal processor (digital signal processor, abbreviated as DSP), an application specific integrated circuit (Application Specific Integrated Circuit, abbreviated as ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.

[0132] The electronic device 100 in this embodiment can be used to execute each step in the various methods provided by the embodiments of the present application.

[0133] In addition, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, it executes the steps of the color balance correction method described in the above method embodiment.

[0134] A computer program product of the color balance correction method provided by the embodiment of the present application includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the steps of the color balance correction method described in the above method embodiment. For details, refer to the above method embodiment and will not be repeated here.

[0135] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the drawings show the possible architectures, functions, and operations of devices, methods, and computer program products according to multiple embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the module, program segment, or part of code includes one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0136] In addition, in each embodiment of the present application, the functional modules can be integrated together to form an independent part, or each module can exist alone, or two or more modules can be integrated to form an independent part.

[0137] When the above-mentioned functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes. It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprising", "including", or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such a process, method, article, or device. Without further limitations, the elements defined by the statement "comprising..." do not exclude the existence of additional identical elements in the process, method, article, or device comprising the said elements.

[0138] The above are only the preferred embodiments of this application and are not used to limit this application. For those skilled in the art, this application can have various changes and modifications. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of this application shall be included within the protection scope of this application. It should be noted that similar reference numerals and letters represent similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.

[0139] The above is only the specific implementation manner of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed by this application can easily think of changes or replacements, which should all be covered within the protection scope of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the claims.

Claims

1. A color balance correction method, characterized in that, Including: Determine a first color pixel and a second color pixel corresponding to the pixel to be corrected, where the first color pixel is a pixel in the same channel as the pixel to be corrected, and the second color pixel is a pixel of the same color as the pixel to be corrected but not in the same channel; Calculate multiple gradient values of the pixel to be corrected at the current position according to the first color pixel; Calculate multiple feature values of multiple second color pixels according to the second color pixel; Calculate a color balance correction value of the pixel to be corrected according to the multiple gradient values and the multiple feature values, and perform color balance correction on the pixel to be corrected through the color balance correction value; The calculating the color balance correction value of the pixel to be corrected according to the multiple gradient values and the multiple feature values, and performing color balance correction on the pixel to be corrected through the color balance correction value includes: Arrange and combine the multiple gradient values and the multiple feature values and then add them to obtain an estimated value of the second color pixel; Calculate the color balance correction value of the pixel to be corrected according to the estimated value of the second color pixel and the pixel value of the pixel to be corrected, and perform color balance correction on the pixel to be corrected through the color balance correction value; The calculating the color balance correction value of the pixel to be corrected according to the estimated value of the second color pixel and the pixel value of the pixel to be corrected, and performing color balance correction on the pixel to be corrected through the color balance correction value includes: Perform filtering processing on the estimated value of the second color pixel and the pixel value of the pixel to be corrected to obtain a final estimated value of the second color pixel; Perform weighted average processing on the final estimated value of the second color pixel and the pixel value of the pixel to be corrected to obtain the color balance correction value of the pixel to be corrected, and perform color balance correction on the pixel to be corrected through the color balance correction value.

2. The method according to claim 1, wherein If the pixel to be corrected is an edge pixel of the target window, before determining the first color pixel and the second color pixel corresponding to the pixel to be corrected, the method further includes: Taking the axis where the adjacent edge pixel of the pixel to be corrected is located as the central axis, and mirror-complementing the pixels on the blank side of the pixel to be corrected with the pixels on the pixel side where the pixel to be corrected is located.

3. The method according to any one of claims 1-2, characterized in that The pixel to be corrected is a green pixel.

4. The method according to any one of claims 1-2, characterized in that The calculating the multiple gradient values of the pixel to be corrected at the current position according to the first color pixel includes: Calculate multiple gradient values of the pixel to be corrected at the current position according to some of the first color pixels in the first color pixel.

5. The method according to any one of claims 1-2, characterized in that, The calculating the feature values of multiple second color pixels according to the second color pixel includes: Calculate the feature values of multiple second color pixels according to some of the second color pixels in the second color pixel.

6. A color balance correction device, characterized in that, Including: A determination module for determining a first color pixel and a second color pixel corresponding to the pixel to be corrected, where the first color pixel is a pixel in the same channel as the pixel to be corrected, and the second color pixel is a pixel of the same color as the pixel to be corrected but not in the same channel; A first calculation module, configured to calculate a plurality of gradient values of the pixel to be corrected at the current position according to the first color pixel; A second calculation module, configured to calculate eigenvalue of a plurality of the second color pixels according to the second color pixel; A third calculation module, configured to calculate a color balance correction value of the pixel to be corrected according to the plurality of gradient values and the plurality of eigenvalue, so as to perform color balance correction on the pixel to be corrected through the color balance correction value; The third calculation module is further configured to: arrange and combine the plurality of gradient values and the plurality of eigenvalue and then add them to obtain an estimated value of the second color pixel; calculate a color balance correction value of the pixel to be corrected according to the estimated value of the second color pixel and the pixel value of the pixel to be corrected, so as to perform color balance correction on the pixel to be corrected through the color balance correction value; The third calculation module is specifically configured to: perform filtering processing on the estimated value of the second color pixel and the pixel value of the pixel to be corrected to obtain a final estimated value of the second color pixel; perform weighted average processing on the final estimated value of the second color pixel and the pixel value of the pixel to be corrected to obtain a color balance correction value of the pixel to be corrected, so as to perform color balance correction on the pixel to be corrected through the color balance correction value.

7. An electronic device, characterized in that, Including: A processor and a memory, where the memory stores machine-readable instructions executable by the processor, and when the electronic device runs, when the machine-readable instructions are executed by the processor, the steps of the method according to any one of claims 1 to 5 are executed.

8. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is run by the processor, the steps of the method according to any one of claims 1 to 5 are executed.

Citation Information

Patent Citations

  • Adaptive analyzer of sensitivity difference of same color pixels and adaptive corrector of sensitivity difference of same color pixels

    US20170064230A1