0

I'm trying to segment an image of round beats on like the ones on an Abacus. The problem is that the beads are close together and using "canny" edge or something similar makes two beads as the same object. I have tried connected components with some tricky thresholds, but it did not work.

Can you please suggest how to better approach this problem?

I need the program to be able to segment each one apart and then count how many there are. Any help would be great.

Thank you!

Mohsin
  • 15
  • 5
  • Can you please supply an example image? Hard to make any suggestions without knowing the nature of the subtle details in the problem :) – Vidar Feb 16 '12 at 10:25
  • Maybe you could do some kind of template matching? (if the picture is taken a certain way, all the beads should look similar in the picture). So yes, an example image will go a long way! – Ashish Uthama Feb 16 '12 at 12:57

1 Answers1

1

Apply the following code to your binary image. bw is the binary image.

D = bwdist(bw);
DL = watershed(D);
bgm = DL == 0;
bw=bw-bgm;
imshow(bw);

Your two objects will be disconnected.

Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254