Consider the following image that has been acquired under uneven lighting:
In[1]:=
img=
;
If no empirically obtained flat-field image is available, one can try to estimate a flat-field image by fitting a model. Obtain a foreground mask to identify the parts of the image that should contribute to flat-field modeling:
Perform a polynomial fit to obtain a flat field and utilize it for a subsequent brightness equalization in each color channel. Brighten the result by applying