MATLAB: Image Segmentation on an Image with low contrast and nonuniform lighting

Image Processing Toolboximage segmentation nonuniform lighting low contrast

The image I'm working with looks like water droplets on a sheet of metal. What I'm trying to do is obtain statistics, such as blob area and centroidal distance of the shapes. I have figured out all of the code to accomplish this, but my code is lacking in the image processing department.
Shadowing has become a factor and due to the non-uniform lighting, it is difficult to do contrast adjustment effectively enough to separate the blobs from the background.
The process I have employed so far to segment the image is to:
(1) adjust the contrast of the image using imadjust
(2) adjust the brightness of the image by adding value 120
(3) threshold the image into a binary using a decision statement
(4) morphologically edit the image using bwerode and fill in holes using imfill
and there's a problem because of the shadows any Help
the Original Image
Image after Segmentation

Best Answer

Steps 1 and 2 are totally unnecessary. The rest of the steps are covered in my BlobsDemo image segmentation tutorial http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
When people need help with images, it's most helpful if they upload an image for us to look at. http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers
Related Question