A method for removing vignetting from an image
By processing image entropy values through logarithmic mapping and optimizing correction functions with mountain climbing algorithm, the problem that it is difficult to solve the global optimal solution for image de-visualization in the prior art is solved, and a more efficient and more accurate image de-visualization effect is achieved.
Patent Information
- Application Number
- CN202111112586.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-23
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2041-09-23
AI Technical Summary
The prior art is difficult to effectively solve the global optimal solution in the process of de-visualization of images, and common logarithmic mapping methods have mathematical derivation vulnerabilities and the wrong perception that the optical center and the geometric center overlap.
Logarithmic mapping is used to process the image entropy value, and combined with the mountain climbing algorithm to optimize the correction function, distinguish the optical center and geometric center of the image to improve the accuracy and efficiency of the algorithm.
Through the optimization of logarithmic entropy and the application of mountain climbing algorithm, the global optimal solution for image deviant can be solved more efficiently, improve the accuracy and performance of the algorithm, and reduce the computational complexity.
Smart Images

Figure CN113888419B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of machine learning such as image processing, and in particular to an image vignetting removal method based on logarithmic mapping and hill climbing algorithm. Background Art
[0002] Vignetting images have the characteristic that the brightness of the four corners of the image is significantly reduced, which is very different from the actual image. De-vignetting the image can achieve vignetting elimination or local elimination operations. Most traditional vignetting methods are calculated based on the original entropy value of the image. If an image has vignetting, its information histogram will have two peaks. The process of correcting vignetting is to move a lower peak closer to another higher peak. In this process, the entropy value of the traditional method is increasing, and the entropy value only decreases when the two peaks overlap, but this will increase the difficulty of solving the global optimal solution, and the correction algorithm is very time-consuming.
[0003] In addition, the common logarithmic mapping method also has loopholes in mathematical derivation and the erroneous perception that the geometric center of the image is the optical center by default. According to the literature (RKLenz and RYTsai. Techniques for calibration of the scale factor and image center for high accuracy 3-D machine vision metrology. IEEE Transactions on Pattern Analysis and Machine Intelligence, 10(5):713-720, 1988), the optical center of the image and the geometric center of the image often do not coincide. Therefore, the existing vignetting removal method needs to be improved. Summary of the invention
[0004] In view of the above prior art, an object of the present invention is to provide an improved method for removing vignetting from an image.
[0005] The technical solution adopted by the present invention is as follows:
[0006] A method for removing dark corners of an image, the method comprising the steps of:
[0007] Step 1: Use logarithmic mapping to process the entropy value of the dark corner image: map the image brightness to [0, N-1] according to the logarithmic mapping formula i(L) = (N-1)log(1+L) / log 256, where L represents the image brightness and N is a parameter; then convert the mapped brightness into Perform histogram information statistics to obtain the corresponding values of each brightness of the image, where x and y are the horizontal and vertical coordinates of the pixel point, and n kis the histogram element;
[0008] Step 2: dimming the image processed in step 1 to reduce the brightness.
[0009] The image vignetting method of the present invention can optimize the global optimal solution by using the logarithmic entropy, and the hill climbing algorithm can also improve the speed of solving the correction function g, and the image geometric center and the optical center are no longer considered to overlap, so that the algorithm accuracy is improved, and the performance of the entire method is improved. Therefore, compared with the traditional vignetting method, the present invention utilizes the computational advantages of the logarithmic entropy and the hill climbing algorithm, and distinguishes the image geometric center from the optical center, so as to realize the function of solving the global optimal solution with high efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 is the normal image histogram and entropy value;
[0011] Figure 2 is the image histogram and entropy value after logarithmic mapping;
[0012] Figure 3 It is a flowchart of the method of the present invention. DETAILED DESCRIPTION
[0013] The technical content and effects of the present invention are further explained below in conjunction with the accompanying drawings and embodiments.
[0014] like Figure 1 As shown, the dark corner image histogram Figure 1 Generally, it is a bimodal distribution, with a low brightness peak near the normal brightness. Therefore, the process of correcting vignetting includes: the approach of the two peaks and the change of entropy value, such as Figure 2 As shown, specifically:
[0015] (1) Double peaks approaching: When correcting for vignetting, the low brightness peak gradually approaches the high brightness peak, overlapping until they coincide.
[0016] (2) Entropy change: When the two peaks are close, the entropy of the entire image remains unchanged. It is not until the two peaks begin to overlap that the entropy begins to increase gradually.
[0017] In view of the defects of the existing methods, the solution to image vignetting of the present invention is as follows:
[0018] (I) First, we process the image entropy value by using logarithmic mapping to solve the global optimal solution, specifically:
[0019] Step 11: for the m pixel values of the image, map each pixel value to the range of [0, N-1] according to the logarithmic mapping formula i(L) = (N-1)log(1+L) / log 256, where L represents the image brightness and N is a parameter, usually 256;
[0020] Step 12: for the m mapped pixel values of the image, this embodiment changes the original histogram information statistical method and adopts a new method to obtain the corresponding values of each brightness of the image, that is,
[0021]
[0022] Among them, x, y are the horizontal and vertical coordinates of the pixel point, i is the logarithmic mapping in step 11, and n k is the histogram element, and the meaning of k is determined by the condition under the summation sign.
[0023] Step 13: The obtained histogram color scale is greatly adjusted, resulting in no histogram information for most color scales. For this, the histogram of step 2) can be Gaussian smoothed to obtain a new histogram;
[0024] Step 14, for the histogram after Gaussian smoothing, the entropy of the image is processed according to the logarithmic entropy formula, that is, in j is satisfied All pixels of G σ is the convolution kernel for Gaussian smoothing.
[0025] (ii) Then, the hill climbing algorithm is used to optimize the correction of vignetting, specifically:
[0026] Step 21, assuming that the coordinates of each point in the dark corner image are (x, y), is the coordinate of the center point of the image; the corrected image brightness is expressed by the new formula:
[0027] L corr (x,y)=L orig (x,y)*g a,b,c (r)
[0028]
[0029] Among them, L corr (x, y) represents the corrected brightness, L orig (x, y) represents the brightness before correction, g a,b,c (r) represents the correction function, which is determined by four parameters: a, b, c, and r. r is determined by the coordinates of the point and the center of the image. According to common sense, the dark corner image should gradually darken from the center of the image to the surrounding area. According to the above function g a,b,c (r) should be monotonically increasing with r (because the present invention is to correct the dark corner image, so the closer to the edge, the larger the function value in the multiplication of the above formula should be), so the function g a,b,c The first-order derivative of (r) should be greater than 0, and the parameter r∈[0,1]. After obtaining this constraint, the function ga,b,c The solution of (r) satisfies the relationship shown in the following formula:
[0030]
[0031] Among them, C1, C2, C3, C4, and C5 meet the following conditions:
[0032] C1=(c≥0∧4b 2 -12ac<0)
[0033] C2=(c≥0∧4b 2 -12ac≥0∧q - ≤0∧q + ≤0)
[0034] C3=(c≥0∧4b 2 -12ac≥0∧q _ ≥0∧q + ≥0)
[0035] C4=(c<0∧q - ≤0∧q + ≥0)
[0036] C5=(c<0∧q - ≥0∧q + ≤0)
[0037]
[0038] Step 22, there are many groups of parameter arrays (a, b, c) that satisfy the above relationship, but the function g a,b,c There is only one set of parameter arrays (a, b, c) with the smallest value of (r). In this embodiment, a hill climbing optimization algorithm is used to quickly solve constants a, b, c. The algorithm first obtains a local optimal solution, that is, obtains a set of arrays (a, b, c) that minimize the logarithmic entropy value H obtained in step 14 above.
[0039] Step 23, each parameter of the array (a, b, c) obtained in step 22 is increased or decreased by δ, δ>0. According to this method, the entropy value is updated to another lower entropy value. If the entropy value cannot be changed, δ is multiplied by a reduction factor k, 0<k<1.
[0040] Step 24, continue to update the entropy value according to the method of steps 21-23 above until the entropy value becomes minimum, which is the unknown constants a, b and c required.
[0041] Among them, in step 21, many conditions in C1, C2, C3, C4, and C5 of the existing hill climbing algorithm are not entirely reasonable. For example, in C2 and C3, when c = 0, q + ,q- There is no function that cannot be defined. Therefore, the present invention proposes a function g q,b,c The new constraints that the parameters (a, b, c) of (r) need to satisfy are as follows:
[0042]
[0043]
[0044]
[0045] C1=(a>0∧b=c=0)
[0046] C2=(a≥0∧b>0∧c=0)
[0047] C3=(c=0Λb<0Λ-a≤2b)
[0048] C4=(c>0Λb 2 <3ac)
[0049] C5=(c>0Λb 2 =3acΛb≥0)
[0050] C6=(c>0Λb 2 =3acΛ-b≥3c)
[0051] C7=(c>0∧b 2 >3ac∧q + ≤0)
[0052] C8=(c>0∧b 2 >3ac∧q - >1)
[0053] C9=(c<0∧b 2 >3ac∧q + ≥1∧q - ≤1)
[0054]
[0055] The above new constraints can avoid the situation where the original constraints cannot find the global optimal solution due to the defects in the setting. In addition, the new constraints simplify the original constraints, increase the rigor of mathematical derivation, simplify calculations, and improve the performance of the algorithm.
[0056] In addition, in the existing hill climbing algorithm, the optical center of the image and the geometric center of the image are often considered to be one point. This embodiment proposes an improved method, and the specific steps are:
[0057] Step 1: Extract the brightness of the image through a low-pass Gaussian filter. The purpose of this is to obtain an estimate of the brightness and brightness of the original image and obtain the entropy value of the image.
[0058] Step 2: Calculate the center CM according to the following formula:
[0059]
[0060] Where I(i,j) is the entropy value of a point in the N*M image obtained in step 1.
[0061] Step 3: Use the obtained CM to update the formula for calculating the parameter r.
[0062]
[0063] where v1=(a+δ,b,c),v2=(a-δ,b,c)
[0064] Step 4, using the parameter r updated in step 3, repeat the formula calculations in steps 11, 12, 14, and 21 to obtain the final new logarithmic entropy value H.
[0065] If the final output logarithmic entropy value is the smallest, then the current set of parameters (a, b, c) is the final desired value. Otherwise, change δ to half of the original value and repeat the above calculation.
[0066] Although the above calculation can distinguish the optical center and the geometric center of the image, the amount of calculation required to implement this method in hardware is too large. Therefore, this embodiment further simplifies the calculation.
[0067] First, it is observed that if the image length and width are compressed to 1 / 5 or 1 / 10 of the original image, it will not have much impact on the final output. However, the algorithm complexity is reduced to 1 / 25 or 1 / 100 of the original. And the three parameters a, b, c ∈ [-2, 2], and r ∈ (0, 1). And r 2 , r 4 , r 6 In this range, the decay is very fast, that is, the influence of its value in the formula is getting smaller and smaller. Therefore, in this embodiment, a, b, and c are discretized, and their intervals are all set to 0.2. Then, according to the new constraint conditions proposed by the present invention, it is judged whether it is reasonable.
[0068] After finding a, b, and c that satisfy the new constraints, the position of the optical center is calculated using the formula for calculating CM in step 2 and the formula for calculating r in step 3.
[0069] Finally, the image is corrected according to step 21. When calculating the correction formula, g a,b,c(r) The root calculation of the derivative, where 1-2 multipliers are used and the multipliers are multiplexed to reduce hardware overhead.
[0070] The method of the present invention can reduce the hardware cost and accelerate the speed of hardware processing images. It can be applied to image optimization, photography and other application fields.
Claims
1. A method for removing dark corners of an image, characterized in that: The steps of the method include: Step 1: Use logarithmic mapping to process the entropy value of the dark corner image: map the image brightness to [0, N-1] according to the logarithmic mapping formula i(L) = (N-1)log(1+L) / log 256, where L represents the image brightness and N is a parameter; then convert the mapped brightness into Perform histogram information statistics to obtain the corresponding values of each brightness of the image, where x and y are the horizontal and vertical coordinates of the pixel point, and n k is the histogram element; Step 2: performing a dimming operation on the image processed in step 1 to reduce the brightness, wherein the specific steps of the dimming operation are: Step 21, assuming that the coordinates of each point in the dark corner image are (x, y), is the coordinate of the center point of the image; the corrected image brightness is expressed by the formula: L corr (x,y)=L orig (x,y)*g a,b,c (r) Among them, L corr (x, y) represents the corrected brightness, L orig (x, y) represents the brightness before correction, g a,b,c (r) represents the correction function; a, b, c are three parameters; Step 22, using constraints: function g a,b,c The first-order derivative of (r) is greater than 0, and the parameter r∈[0,1], we can get the relationship: C1=(a>0∧b=c=0) C2=(a≥0∧b>0∧c=0) C3=(c=0∧b<0∧-a≤2b) C4=(c>0∧b 2 <3ac) C5=(c>0∧b 2 (=3ac∧b≥0) C6=(c>0∧b 2 =3ac∧-b≥3c) C7=(c>0∧b 2 >3ac∧q + ≤0) C8=(c>0∧b 2 >3ac∧q - >1) C9=(c<0∧b 2 >3ac∧q + ≥1∧q - ≤1) in, Using the above relationship, we can find a set of correction functions g in step 21: a,b,c (r) The smallest parameter array (a,b,c).
2. The image vignetting method according to claim 1, characterized in that: In the said step 22, the parameter array is quickly solved by the hill climbing algorithm, and the specific method is as follows: each parameter of the parameter array (a, b, c) is increased or decreased by a value δ, where δ > 0; then the function value of the function g a,b,c (r) is updated to a new function value. If the updated logarithmic entropy value remains unchanged, the value δ is multiplied by a reduction factor k, where 0 < k < 1; then the function value is continuously updated until the logarithmic entropy value becomes the minimum, that is, the required parameter array (a, b, c) is obtained.
3. The image vignetting method according to claim 2, characterized in that: In step 21, the calculation method of the brightness of the image pixel and its geometric distance from the center of the image is: Step 211, extracting the brightness of the picture through a low-pass Gaussian filter to obtain the brightness of the image; Step 212, calculate the center coordinates according to the following formula, denoted as CM: Where I(i,j) is the brightness of a certain point of the N*M image obtained in step 211; Step 213, using the obtained CM to update the calculation parameter r: Among them, v1=(a+δ,b,c), v2=(a-δ,b,c), CM=(CM1,CM2).
Citation Information
Patent Citations
Image dark corner removing method and device for large visual field camera
CN107172323A
A high dynamic range image tone mapping method with detail enhancement and brightness self-adaptation
CN109410126A
Cited By
Microscopic image vignetting correction method
CN121937340A