Image Auto-de-Dim angle algorithm

Source: Internet
Author: User
Tags first row

Dark angle image is a more common image in the reality, its main feature is the four corners of the image has a significant decrease in brightness, such as the following two pictures:


In 2014, Y.zheng and other people's "single image vignetting correction" as well as their paper "Single image vignetting correction using radial Gradient symmetry "has to say this aspect of the algorithm, but its implementation of a high degree of complexity, even if it can be programmed to achieve, speed estimation is very slow, its practicality is not high.

Another paper, entitled Single-image vignetting Correction by Constrained minimization of Log-intensity Entropy, provides a relatively simple algorithm. The core idea of this paper is:

First:

The dark corner can be said to be a special case of shadow correction, and the minimization of the entropy of the whole image is also proved to be an effective method for shadow correction, but the common entropy is optimized to the local optimum in the process of optimization. Therefore, the paper presents a concept of logarithmic entropy (log-intensity Entropy), which is illustrated by the data, assuming that the histogram of an ordinary normal image is a single peak distribution, then if the image has a dark angle, The histogram must have another low-luminosity distribution, as shown in the following figure:


Our process of correcting the dark angle is to make the distribution of the low luminosity close to the original normal brightness, the data from the first row of the above figure can be seen, the entropy will be reduced until the two histogram has some overlap, the entropy is always increased, and the logarithmic entropy is at least not increased before the overlap. Therefore, the global optimal solution can be obtained better.

The paper proposes the realization of logarithmic entropy:

1.1 A logarithmic mapping of brightness, the formula is:


is to map the pixel value in [0,255] to [0, N-1], but not the linear mapping, but based on the logarithmic relationship mapping, usually N is the 256, so the mapped pixel range is still [0,255], but note that I (L) here is already a floating point. We draw a curve where n equals 256:


As the above figure shows, this operation actually turns the image overall on. Since the map color scale is already floating point number, therefore, the histogram information statistics must be different way, the paper gives the formula is:


The formula is very complex, in fact, it is a bit like linear interpolation that meaning, do not know the two mathematical symbols, that is, rounding up and rounding down. Such logarithmic entropy histogram information will be due to a large scale adjustment, resulting in a lot of color scale is no histogram information, the histogram information can generally be lower Gaussian smooth, to obtain a new histogram.

The logarithmic entropy of the last image is calculated as follows:


Second:

A dark-angle image with a reduced brightness:


where x and y are the coordinates of each point of the image, they represent the center of the dark Corner, and they and A, B, and C are unknown quantities. We can see that when r=0, the correction factor is 1, i.e. no correction is required. When r=1, the correction factor is 1+a+b+c.

Then the image after the dim angle correction is:


The paper summarizes the a,b,c that meet the following relationship:


Third:

The formula (with parameters) for correcting the dark image is described above, and the indicator that evaluates whether an image has a dark angle, the last step is to use this indicator to determine the parameters of the formula. We have 5 unknown parameters, i.e. A, B, C, and the center point of the dark corner. Solving this constrained optimal problem is a special algorithm, and it is very computationally time-consuming. Therefore, the author proposes a fast algorithm: Hill climbing with rejection of invalid solutions.

I looked at the algorithm a little bit, and it was really a good idea, but I didn't do it, and I took another rough approach to optimization.
First of all, it is clear that in order to calculate these optimal parameters, we do not have to directly calculate the original size directly, this is also stated in the original paper, even if we narrow their width to the original 1/5 or even 1/10 calculated results will not be too much difference, The difference of these parameters has little effect on the final result, but the calculation can be reduced to the original 1/25 and 1/100.
Then, we observed that the optimal range of A, B and C is generally between 2 and 2, and from the formula of G to know that because R is a positive number between 0 and 1, r^2, R^4, r^6 in the numerical decline very fast, such as r=0.8, then the corresponding results of the three are 0.64, 0.4096, 0.2621, therefore, the effects of A and B and C on the final result in the formula are also decreasing.
Then, we can refer to the previous contrast retention color image de-color algorithm---Basic algorithm can also be in the optimization of the article, the A, B, c three parameters in the [ -2,2] discretization between, considering that the parameters of a slight difference will not have too much impact on the results, and A, B, C importance, We can set A, B, c of the discrete interval of 0.2, 0.3, 0.4, and then synthesize the above to determine whether a, B, C is a reasonable combination of functions, discrete sampling of the calculation of the combination of about 300 possible, the small figure calculation of 300 possibilities of time is completely acceptable, even consider the extreme point , the calculation of C is placed on the outer side of the loop, that is, C takes a fixed value of 0, and then calculates the preferred a and B values, in the calculation of C value.
The above calculation process does not take into account the extent of the center point of the dark angle, we are fixed to place the center point of the dark angle in the image of the positive central position, that is (WIDTH/2, HEIGHT/2), in fact, for most of the pictures taken, the dark Corner is located in the center, so this assumption is understandable, Because the increase of the dark angle center calculation will inevitably increase the computational amount, in order to find out the reasonable position of the dark angle Center, we calculate the above a, B, C, in the small figure in a certain step in accordance with the formula to calculate the rough center position, and then zoom into the original.
After calculating the above, A, B, C, and the center point, it can be corrected again according to the correction formula, note that the effect of the dark angle is equal to each channel, so each channel should be multiplied by the same value.
Here are some of the resulting graphs that are processed using the algorithms in the paper:




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.