Image Segmentation on an Image with low contrast and nonuniform lighting

8 views (last 30 days)
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!

Accepted Answer

Image Analyst
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
Caleb
Caleb on 18 Jun 2012
Also, I'm looking at the histogram of my original image and comparing it to the histogram of your blobsDemo.m file. Your image had a binodal distribution, which lent itself to an easy threshold value. My image has a normal distribution with its center at ~110 and extreme points at ~60 and ~160, which does not lend itself to easy thresholding. Would you suggest a histogram equalizer or something else to help the image processing along?
Image Analyst
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).

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!