I am having troubles correcting a microscope image with uneven illumination. I need to count cells in an image, of which are touching. The area I am showing is the section that is darker in the image.
I have tried the following code, and also functions such as: bw2 = imbinarize(I,'adaptive','ForegroundPolarity','dark'); to correct for it. Unfortunately either non-cells stay in the final image or some of the cells that are in a darker area of the image disappear entirely.
(Invertgray is just the original grayscale image, inverted.)
I have included various different results I have gotten:
background = imopen(invertgray, strel('disk', 10));
I2 = invertgray - 1.2*background;
adjust = imadjust(I2);
BW = imbinarize(adjust);