问题
So I have an image that has some dark spots, and they look pretty simple so I think I can creaat an luminance map, invert it and then apply it to my image to undo the dark spots. However all I can find is two methods for equalizing: equalize whole image(with histogram) or segment the image in dark meddium and light parts and equalize which you want. The first approach does not help my problem and the second approach also makes the dark objects in the image lighter. I am sure there is an easy way to do this (long ago I saw somebody do it in a presentation), although I havent been able to find it or come up with it yet.
So my question: how would I create a "luminance map" of an image like this:
So I get a map like this:
Which I can apply inversely to get a better image like this:
I understand I will have discretization errors at the corrected spots, but thats much better than the dark spots. I hope someone can help me do this, thanks!
I mainly use Matlab and have some limited python and mathematica knowledge, but a Matlab example would be most useful to me. One way I thought of myself was taking fft2 and nulling the low frequencies, but that would just destroy all contrast, not just the partss I want.
Similar but different SO questions that did not help me:
Image equalisation
thresholding an image based on gradient
Histogram of image
Matlab - Local Histogram Equalization
How to find out light, medium and dark color?
回答1:
You will have to very precisely model the nature of the dark spots for this process to work. Can you characterize whether the dark gradient is linear, exponential, power, trigonometric, or some other predictable function? Is it always exactly circular?
Having straight-line elements in the photo helps, and may provide a source of samples to calculate the nature of the dark spot from. If you treat the dark spot like a quadratic or cubic function in three dimensions (X, Y, luminance) then you can solve it based on a certain number of known points.
来源:https://stackoverflow.com/questions/19035835/correct-image-for-local-dark-light-spots-equalise-luminance-intensity-loca