Image Segmentation on an Image with low contrast and nonuniform lighting
10 views (last 30 days)
Show older comments
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) apply a median filter to the image using medfilt2
(3) apply a top-hat filter using a structuring element imtophat(IM, se)
(4) adjust the contrast again using imadjust
(5) threshold the image into a binary using a decision statement
(6) morphologically open the image using bwareaopen and fill in holes using imfill
As of now, my code is able to pick out nearly all of the blobs in the image, but the centroids are obviously skewed, mostly due to shadowing I would guess. The blob area also may be a little skewed, which I think can be attributed to all of the complications that I've listed so far.
I would like to know if there are any suggestions for improving this process or maybe changing it completely. Thank you!
0 Comments
Accepted Answer
Image Analyst
on 18 Jun 2012
The imadjust() calls are not really necessary. I'm not sure what your image looks like since you didn't upload it, or tell us where it was. I assume steps 7 was a call to regionprops(). Other than that, it's probably okay. See my image segmentation tutorial if you want to see how I do it for one kind of image (with uniform background): http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
Skewed distributions is normal for particle size analysis. They almost always show a log-normal or Lorentzian shape no matter what measurement you're looking at. There's even theory that says why (ref: http://search.barnesandnoble.com/Particle-Size-Measurement/Terence-Allen/e/9780412729508, which is the bible of particle size analysis) Don't expect that you'll get textbook perfect Gaussian-looking distributions - it almost never happens. They're almost always skewed.
The locations of your centroids may be shifted due to shadowing issues. That's why it's always best to try to correct image capture problems first rather than try to compensate for them during post processing.
5 Comments
Image Analyst
on 18 Jun 2012
You wouldn't add them, you'd AND them with the & operator since they are binary (logical) images. With a background gradient, you won't have a nice bimodal histogram, so you need to use local methods like tophat filter, or else correct for the background, maybe by using a 2D polynomial and then dividing your image by the modeled background. I use John D'Errico's polyfitn to do background modeling: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A679
Don't do histogram equalization. It is a complete waste of time and won't help at all in this kind of situation (even though I have a really nice one in the File Exchange).
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!