views:

46

answers:

3

When I apply erosion to my image to find small ball or disk shaped objects, no matter how much I change the size of the structuring element it doesn't seem to work. Instead the entire image appears kind of smudged by the structuring elements. I can still see where the objects are, but it doesn't help me locate them. Is there a way to refine this technique?

A: 

You should always use opening/closing. Your erosion will "damage" the objects that you want to find, so you should do dilation after. This is was opening/closing does. Here is a small matlab program for detecting "blobs" in an image:

Ib = binary_image // Whatever image
[L, n] = bwlabel(Ib);
RGB = label2rgb(L, 'spring', 'c', 'shuffle');
figure, imshow(RGB);
imwrite(RGB, 'segmented.jpg');
stats  = regionprops(L)
InsertNickHere
A: 

If it's grayscale you might want to look into preprocessing with filters.

spiel
A: 

InsertNickHere touched on what I think your confusion is, without explicitly explaining it. It sounds like you're expecting the results that erode/dilate/open/close give with a binary image. Performing those operations on a typical grayscale image will give the behavior you're getting.

If you can, try converting your image to a binary image (by thresholding, probably), and then performing your morphological operations on it.

TG_Matt