Count number of circles

hey guys,

i’d need some advise on the attached image.
we’d like to count the number of circles in this image.
challenges are that they have different sizes and different intensities.

any ideas?

so far i tried:

  • hough transforms (enhance circles), which is a bit annoying because of the different circle sizes
  • invert the image and find the black regions inside the circles, which is a bit annoying, because if one circle is not really perfectly closed it “leaks out”

cheers, tischi

Hi Tischi,

I’m attaching a pipeline which should at least get you a bit closer to a solution. Essentially the steps are these:

  • EnhanceOrSupressFeatures using “Neurites” as the feature. This is just a way of enhancing long, thin features of some intensity. Normally, “Speckles” is my first resort of feature of choice, but this seemed to do better.
  • Object identification of the inverted image of the above using Laplacian of Gaussian (LoG) as the declumping method. The LoG method is the preferred approach when you have many overlalping blobs of variable intensity, but the settings can be somewhat tricky to optimize. Also in this case, is seemed easier to identify the blobs outright rather than the blob borders.

2012_05_26.cp (4.3 KB)

Hi Mark,

thanks for the suggestion!

in fact, i tried the “Neurite” Detection but in my version, CP11710 for Windows, the image looks exactly the same before and after the filtering.

did you use another version?


Hi Mark,

a few more questions:

i) in the internet i found that “black tophat” is defined as closing-original and not as opening-original as it is described in the help for your “neurites” detection. do you know which one is correct?

in the attached pipeline i manually construct whiteTophat-blackTophat:

ii) the resulting image has negative pixel values (which i personally don’t think is a problem, but for these morphological operations it is something that people typically tend to avoid…); is that on purpose?

iii) how does the subtraction of the blackTophat help to improve the line detection? is there a publication or something about it?

Cheers, Tischi
WhiteMinusBlackTophat.cp (4.25 KB)


did anyone get a chance to look at the issues posted in this thread?

i think i might be worth it, because to me, it looks a bit like something could be wrong with the code…

Cheers, Tischi

Hi Tischi,

Thanks for pointing this out. :smiley: It turns out that the code is correct; it’s the documentation that’s wrong. We’ve fixed this, so the next release will have the correct wording.

Good catch!