A vignetting correction method based on color intensity entropy and gradient sparsity optimization
The vignetting correction method optimized by color intensity entropy and gradient sparsity solves the problems of poor reusability and slow speed of vignetting correction methods in the existing technology, achieves efficient and accurate vignetting correction effects, and is suitable for a variety of scenarios.
Patent Information
- Application Number
- CN202411637294.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2044-11-15
AI Technical Summary
The vignetting correction methods in the existing technology have a large workload and poor reusability in industrial applications, the calibration method is costly, and the single-image correction method is greatly affected by the scene and has poor effect, making it difficult to be widely used in practical applications.
A vignetting correction method based on color intensity entropy and gradient sparsity optimization is adopted. Through vignetting model, color space conversion, histogram statistics, information entropy calculation, gradient solution and gradient descent optimization, a vignetting correction loss function is constructed, and the vignetting parameters are iteratively optimized to achieve accurate correction.
It effectively reduces the image color intensity entropy, increases the image gradient, improves the correction accuracy and applicability, solves the reusability and speed problems of traditional methods, and achieves fast and accurate vignetting correction.
Smart Images

Figure CN119540111B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a vignetting correction method with optimized color intensity entropy and gradient sparsity. Background Art
[0002] Vignetting correction is an essential step in image signal processing and a crucial factor in obtaining high-quality images. Current mainstream methods primarily include calibration and single-image correction. Calibration methods are labor-intensive and lack reusability. In particular, changes in the shooting scene or shooting mode can alter the vignetting effect, making calibration expensive in industrial applications. Current single-image correction methods are generally significantly affected by the scene, have stringent prior assumptions, and exhibit poor vignetting removal performance, making them difficult to incorporate into practical applications.
[0003] Therefore, developing a vignetting correction algorithm with strong universality and high accuracy has important research significance at present and is an important guarantee for obtaining high-quality images. The present invention proposes a vignetting correction method that optimizes color intensity entropy and gradient sparsity. Summary of the Invention
[0004] The present invention proposes a vignetting correction method that optimizes color intensity entropy and gradient sparsity to solve the above-mentioned technical problems in the prior art.
[0005] According to one aspect of the present invention, a vignetting correction method based on color intensity entropy and gradient sparsity optimization is provided, and the process is as follows: Figure 1 As shown, the following steps are included:
[0006] A) constructing an initial vignetting model V_0 based on the polynomial formula of the vignetting model and setting default parameters P_0, and performing an initial correction on the image using the vignetting model to obtain a corrected image I_c;
[0007] B) converting the corrected image I_c from RGB space to HSV space to obtain image I_h;
[0008] C) Divide the histogram by color (HS) and intensity (V) values, and perform histogram statistics on the image I_h in the HSV space to obtain the histogram C_H;
[0009] D) processing the histogram C_H obtained in step C) according to the color dimension, using the information entropy formula to estimate the probability of the pixel intensity distribution under each color, and based on this, obtain the color intensity entropy index E_o of the entire image;
[0010] E) using a gradient function to calculate the gradient of the image I_c in step C), and calculating the L1 norm L_o of the image gradient;
[0011] F) constructing a vignetting correction loss function based on the color intensity entropy index E_o and the L1 norm L_o of the image gradient obtained in steps D) and E), and calculating the loss function value loss_o of the image;
[0012] G) Determine whether the loss function value loss_o and the number of iterations meet the threshold conditions. If so, output I_c as the vignetting-corrected image. If not, proceed to the next step.
[0013] H) using the gradient descent optimization method, calculating the optimization vector of the vignetting parameter based on the difference in the loss function values before and after image correction, obtaining the new parameter P_c, and increasing the number of iterations by 1;
[0014] I) Calculate a new vignetting model based on the optimized vignetting parameters and replace the initial vignetting model V_0 with the new vignetting model, and repeat steps A) to I) until a threshold condition for exiting the loop is met.
[0015] The vignetting model used in step A) is a classic quartic polynomial model, as specifically shown in Formula 1, where x represents the distance between the pixel and the vignetting center, V(x) represents the vignetting degree at a distance x from the vignetting center, and a, b, and c are parameters.
[0016] V (x) =a+bx 2 +cx 4 (1)
[0017] Wherein, the image color space conversion method in step B) adopts the CIE standard;
[0018] The color intensity histogram division process in step C) is as follows: the three HSV spaces are divided into 20 parts (h1-h20, s1-s20, v1-v20, where h, s, and v represent the indexes of the histogram in the three spaces) at equal intervals;
[0019] The color intensity histogram statistics process in step C) is as follows: traverse all pixels of the image, calculate which interval their h, s, and v fall into, and add 1 to the corresponding histogram element;
[0020] The information entropy statistical process in step D) is: extract all elements in the histogram with the same h and s indexes but different v indexes, and solve the information entropy of these elements. The information entropy calculation process is shown in equations (2) and (3). C_H represents the color intensity histogram calculated in step C), h j ,s k ,v iwhere j, k, and i represent the histogram indices of the hue, saturation, and intensity dimensions of the histogram in step C), respectively. j, k, and i range from 1 to 20. In formula (3), the upper and lower bounds of ∑ represent the change from 1 to 20 for i. In formula (2), the upper and lower bounds of ∑ represent the change from 1 to 20 for j and k, respectively. The resulting E_o is the color intensity entropy index.
[0021]
[0022] in:
[0023] Wherein, the method for solving the image gradient in step E) includes but is not limited to the Sobel operator, the Canny operator, the Laplace operator, etc.;
[0024] The vignetting correction loss function in step F) is as follows, E_o is the color intensity entropy index calculated in step D), L_o is the image gradient L1 norm calculated in step E), λ represents the regularization coefficient, and loss_o is the calculated vignetting correction loss function value.
[0025] loss_o=E_o+λ·L_o (4)
[0026] Wherein, the threshold condition in step G) is that the loss function value is less than 0.01 or the number of iterations is greater than or equal to the maximum number of iterations;
[0027] Among them, the gradient descent optimization method in step H) adopts the SGD technology.
[0028] Compared with the prior art, the present invention has the following beneficial effects:
[0029] This paper proposes a vignetting correction method that optimizes color intensity entropy and gradient sparsity. This method effectively leverages the prior knowledge that vignetting reduces image color intensity entropy and increases image gradients. By rationally optimizing the image's color intensity entropy and gradient sparsity, it achieves image vignetting correction, circumventing the high workload and poor reusability of traditional calibration-based vignetting methods. Compared to other vignetting correction methods, the method proposed in this paper relies on more universal prior knowledge, has wider applicability, and can achieve more accurate vignetting correction results. Furthermore, through gradient descent optimization, this method improves computational speed, addressing the technical challenge of single-image correction methods that hinders real-time application. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 1 is a schematic diagram of an algorithm flow of a vignetting correction method for optimizing color intensity entropy and gradient sparsity according to the present invention;
[0031] Figure 2 (A) to Figure 2(D) is a schematic diagram of converting an RGB image into an HSV space according to an embodiment of the present invention;
[0032] Figure 3 2. It is a schematic diagram of performing histogram statistics on an HSV spatial image according to an embodiment of the present invention;
[0033] Figure 4 is a schematic diagram of solving the gradient of an HSV space image according to an embodiment of the present invention;
[0034] Figure 5 (A) to Figure 5 (D) is a schematic diagram of an iterative optimization process according to one embodiment of the present invention;
[0035] Figure 6 (A) to Figure 6 (H) is a schematic diagram of vignetting correction according to several embodiments of the present invention. DETAILED DESCRIPTION
[0036] In such Figure 1 In the specific embodiment of the present invention shown, the input image data is I_r, the output is the image I_c after vignetting correction, and the initial number of iterations iter=0 is set.
[0037] According to a vignetting correction method of the embodiment of the present invention that optimizes color intensity entropy and gradient sparsity, the method can achieve good results in image vignetting correction, such as Figure 1 As shown, the following steps are included:
[0038] A) The vignetting model used in this embodiment is a classic polynomial model as shown in Equation (5), where x represents the distance between the pixel and the vignetting center of the image, the parameters are a, b, c, and V(x) represents the vignetting degree at a distance x from the vignetting center.
[0039] V (x) =a+bx 2 +cx 4 (5)
[0040] The image vignetting center is calculated based on the image size, and the initial vignetting model V_0 is constructed according to the preset default parameters according to Equation (5). Specifically, in this embodiment, the default parameters are a = 0.5, b = 0.2, and c = 0.1. The distance x between the pixel and the vignetting center is calculated using the Euclidean distance, as shown in Equation (6). Where (i, j) is the horizontal and vertical coordinates of the pixel, and i0 and j0 represent the coordinates of the image vignetting center, which is generally the center of the image and can be calculated by dividing the horizontal and vertical dimensions of the input image by 2.
[0041]
[0042] B) Using the vignetting model V_0 in step A), the original image I_r is vignetted. The correction method is to divide the original image by the vignetting model, as shown in formula (7).
[0043] I_c=I_r / V_0 (7)
[0044] C) Use the CIE standard to convert the color space of the image I_c in step B) to obtain the HSV space image I_h. The conversion equations are shown in equations (8)-(11), where equations (8)-(10) are the conversion formulas for H (hue), S (saturation) and V (intensity), respectively. Equation (11) is the intermediate variable calculation method needed in the process. R, G, and B represent the values of the pixels in the RGB image space, max means the maximum value, and min means the minimum value. The result of converting the original image to the HSV space is as follows: Figure 2 As shown, Figure 2 (A) represents the original input image, Figure 2 (B) represents the H channel component after HSV conversion. Figure 2 (C) represents the S channel component after HSV conversion, Figure 2 (D) represents the V channel component after HSV conversion. Through the above method, the color information (H and S) of the image can be separated from the intensity information (V), which is convenient for subsequent operations.
[0045]
[0046] V=Cmax(10)
[0047] in:
[0048] D) Divide the histogram into groups in the HSV space for histogram statistics. This embodiment divides the histogram in an equally spaced manner, dividing the three HSV channels into 20 equal parts. The H value range is 0-360, the S value range is 0-1, and the V value range is 0-1. Therefore, in this embodiment, the group interval of H is 18, and the group intervals of S and V are both 0.05. The histogram category labels of each group are respectively recorded as h1, h2, h3...h20, s1, s2, s3...s20, v1, v2, v3...v20. In this embodiment, the histogram statistics results have a total of 20*20*20=8000 groups.
[0049] E) Perform histogram statistics on the HSV domain image obtained in step C) according to the group interval divided in step D). The process is as follows: traverse all pixels on the image, extract the H, S, and V values of each pixel, and divide them by the group interval. The result is the index of each channel in the histogram, as shown in formula (12).
[0050]
[0051] For example, for a pixel with an HSV value of (165, 0.41, 0.77), its corresponding histogram is h9s8v15. Figure 3 This is a schematic diagram of an embodiment of histogram statistics for HSV space images, where the horizontal direction represents the color and saturation direction, the vertical direction represents the intensity direction, and the grayscale value of each histogram area represents the number of pixels in the histogram. A larger grayscale value indicates a greater number of pixels in the histogram.
[0052] F) In HSV space, H and S represent the color information of the image, so histograms with the same h and s groups are histograms with the same color. Histograms with the same V group are histograms with the same intensity. In this embodiment, for the histograms obtained in step E), histograms with the same color are extracted, for example: h1s1v1, h1s1v2, h1s1v3...h1s1v20, and the degree of aggregation of the pixel intensity distribution in the above histograms with the same color is statistically analyzed. This embodiment uses information entropy to characterize this characteristic. The information entropy calculation process is shown in formula (13), where h j ,s k ,v i Respectively represent the histogram index in the three directions of hue, saturation and intensity, j, k, i range from 1 to 20, Indicates the color intensity histogram calculated in step C) at index h j s k v i The value of ∑ in formula (13) means that for i changing from 1 to 20, that is, for a fixed color and saturation histogram index, all intensity histogram indexes are traversed. The solution is That is the color intensity entropy under the color intensity index.
[0053]
[0054] G) Traverse all colors in the histogram. The traversal process is as follows: h1s1, h1s2, h1s3... h1s20, h2s1, h2s2... h2s20, h3s1... h20s1, h20s2... h20s20. For each color, calculate the information entropy of all histograms for each color according to step F). The sum of the intensity information entropy for all colors is used as the entropy index of the entire image, that is, the color intensity entropy index E_o of image I_h, as shown in formula (14), where the upper and lower limits of ∑ represent j and k varying from 1 to 20, respectively.
[0055]
[0056] H) In this embodiment, the Laplace operator is used to process the V component of the image I_h to calculate the gradient of the image. The Laplace operator is shown in formula (15).
[0057]
[0058] The gradient information of the image is obtained as I_g, Figure 4 Schematic diagram of an embodiment of the present invention for solving gradient.
[0059] I) Solve the L1 norm of the gradient image I_g obtained in step H), and the process is shown in formula (16) to obtain the evaluation index L_o for the image gradient information, where i, j represents the image pixel coordinates and ∑ represents the summation of all pixels.
[0060]
[0061] J) Construct a vignetting optimization loss function according to formula (17), where λ is the regularization coefficient, which is 0.1 in this embodiment. Using the gradient information evaluation index L_o obtained in step I) and the image entropy evaluation index E_o obtained in step G), calculate the loss function value of the image.
[0062] loss_o=E_o+λ·L_o (17)
[0063] K) Determine whether the loss obtained in step J) is less than a threshold (set to 0.01 in this embodiment). If so, output the final vignetting correction result I_c as the final result. If the loss function value does not reach the threshold, increment the number of iterations iter by 1, and determine whether the number of iterations has reached the maximum number (set to 100 in this embodiment). If so, exit the loop and output the final vignetting correction result I_c as the final result.
[0064] L) If the loss function value and the number of iterations in step K) both meet the exit condition, the vignetting parameters are optimized, and the vignetting correction effect is gradually optimized through an iterative method. In this embodiment, the vignetting parameters are optimized using a gradient descent method. The steps are to calculate the optimized vector of the vignetting parameters based on the ratio of the loss function change to the parameter change, and then calculate the new vignetting parameters based on the optimized vector, as shown in equations (18)-(20).
[0065]
[0066] Where d represents the gradient operation, a, b, c are the vignetting parameters used in this iteration, and a', b', c' are the optimized vignetting parameters.
[0067] M) Inputting the new vignetting parameters a', b', c' calculated in step L) into step A), calculating a new vignetting model, and repeating steps A) to L) until the condition for exiting the iteration is met. Figure 5 (A)-5(D) are schematic diagrams of an iterative optimization process according to an embodiment of the present invention, wherein: Figure 5 (A) represents the original image, Figure 5 (B) shows the correction result based on the default vignetting parameters. Figure 5 (C) shows the correction result after 3 iterations. Figure 5 (D) shows the final vignetting correction result when exiting the loop.
[0068] Figure 6 (A) to (H) are schematic diagrams of vignetting correction according to several embodiments of the present invention, wherein: Figure 6 (A) Figure 6 (C) Figure 6 (E) Figure 6 (G) is the original image, Figure 6 (B) Figure 6 (D) Figure 6 (F) Figure 6 (H) is the corresponding vignetting correction result.
[0069] Advantages of the present invention include:
[0070] (1) The present invention proposes a method for calculating the color intensity entropy of a statistical image. By performing color intensity decomposition on an image, the brightness balance of different colors in the image can be effectively characterized.
[0071] (2) The present invention proposes a priori constraint that vignetting will lead to an increase in image color intensity entropy. Compared with the prior constraint that only relies on intensity information, the prior constraint proposed by the present invention has strong universality and is applicable to a wider range of scenarios;
[0072] (3) The present invention proposes a vignetting correction method that optimizes color intensity entropy and gradient sparsity, which can quickly and accurately achieve image vignetting correction. This method does not require calibration and can be applied to various types of RGB images, which is of great significance for the practical application of vignetting correction algorithms.
Claims
1. A vignetting correction method based on color intensity entropy and gradient sparsity optimization, characterized in that The following steps are involved: A) establishing an initial vignetting model based on the image size and initial vignetting parameters, using the classic quartic polynomial model shown in formula (1) as the vignetting model, where x represents the distance between the pixel and the vignetting center of the image, the parameters are a, b, c, and V(x) represents the vignetting degree at a distance x from the vignetting center. Using this model, perform initial vignetting correction to obtain an initial vignetting-corrected image; V (x) =a+bx 2 +cx 4 (1) B) converting the image in step A) into HSV space, and performing histogram statistics on the image using parameters including at least one of equal interval group spacing and non-equal interval group spacing; C) performing color intensity entropy statistics on the histogram of the HSV domain obtained in step B), and using it as the color intensity entropy evaluation index of the image; the color intensity entropy statistical process includes solving the entropy value of the intensity (V) distribution of the histogram with the same hue (H) and saturation (S), and the solution process is shown in formulas (2) and (3), where Represents the color intensity histogram h j s k v i The value of h j ,s k ,v i They represent the histogram indexes of the step histogram in the three directions of hue, saturation and intensity respectively. max_j, max_k and max_i represent the maximum values of the histogram index respectively. The final solved E_o is the color intensity entropy index. in: D) for the vignetting-corrected image obtained in step A), solving the gradient of at least one of the RGB image itself, the HSV image, and the V channel of the HSV image; E) calculating a norm of the image gradient obtained in step D), and using the norm as a gradient index evaluation of the image; F) Combining the image entropy evaluation index obtained in step C) with the image gradient evaluation index obtained in step E) to construct an image vignetting optimization loss function as shown in formula (4); wherein E_o is the color intensity entropy index calculated in step C), L_o is the image gradient index evaluation calculated in step E), λ represents the regularization coefficient, and loss_o is the calculated vignetting correction loss function value. loss_o=E_o+λ·L_o (4) G) optimizing the vignetting parameters using a convex function optimization method for the loss function value obtained in step F); H) determining whether the optimization termination condition is met, outputting the last vignetting correction result if the termination condition is met, and replacing the initial vignetting parameters with the optimized vignetting parameters if the termination condition is not met, and repeating steps A) to H) until the iteration terminates.
2. The vignetting correction method with color intensity entropy and gradient sparsity optimization according to claim 1, characterized in that: The initial correction process is to divide the original image by the initial vignetting model, as shown in formula (5), where V_0 is the initial vignetting model, I_r is the original image, and I_c is the correction result. I_c=I_r / V_0 (5).
3. The vignetting correction method with color intensity entropy and gradient sparsity optimization according to claim 1, characterized in that: The entropy value includes at least one of information entropy, cross entropy, and joint entropy.
4. The vignetting correction method with color intensity entropy and gradient sparsity optimization according to claim 1, characterized in that: In the step D), at least one of a Soble operator, a Canny operator, and a Laplace operator is used to solve the image gradient.
5. The vignetting correction method with color intensity entropy and gradient sparsity optimization according to claim 1, characterized in that: The operation of obtaining the norm in step E) uses at least one of the L0 norm, the L1 norm, and the L2 norm.
6. The vignetting correction method with color intensity entropy and gradient sparsity optimization according to claim 1, characterized in that: In the step F), the operation of constructing the vignetting optimization loss function adopts at least one of weighted addition, logarithmic addition, and exponential addition.
7. The vignetting correction method with color intensity entropy and gradient sparsity optimization according to claim 1, characterized in that: In step G), the convex function optimization method includes at least one of a gradient descent method and a dual descent method.
8. The vignetting correction method with color intensity entropy and gradient sparsity optimization according to claim 1, characterized in that: In the step H), the iteration termination condition adopted includes at least one of reaching the maximum number of iterations, loss being lower than a threshold, and loss no longer decreasing.