I'm trying to automatically calculate particles sizes histogram for images like this one:

Image example: sphere particles with overlapping and superposition

Common threshold and segmentation doesn't seem to work. What filters and algorithms do you suggest to be used?


1 Answer 1


Here is what I experimented with:

  1. Use ELSD to generate elliptic contours. You could basically use any edge detector, but since in the following stages I will benefit from circle detectors, it is good to already have some geometrical edges. Here is what the output looks like:                                                            enter image description here

  2. Collect all circular (also non-circular) edges via collecting the channels into a single image. This can also be done via simple thresholding. Again, the output looks like:                                                            enter image description here

I will denote this image to be $C$.

  1. We will now compute the circular hough transform on this image. However, there are many spheres (which appear to be circular) in varying radii. Thus, we select a range $\mathbf{r}=\{9, 12, 15..150\}$ to be the expected radii per hough transform. The pseudocode looks like:

       $c_x$ $\leftarrow$ $\emptyset$, $c_y$ $\leftarrow$ $\emptyset$

       for all ($r_i \in \mathbf{r}$) $\{$

          {x, y} = hough_circles($C$, $r_i$)

          $c_x \leftarrow \{c_x \cup x \}$

          $c_y \leftarrow \{c_y \cup y \}$


Depending on the peaks of the accumulator, Hough might report multiple center locations. A simple clustering might help avoiding this (Just average the close-by centers).

The final image with the resulting centers overlayed (in different colors), looks like:

enter image description here

You could customize the radius to be robust to different circles. Moreover, one can use elliptic Hough transform to have a better coverage of the particles (as some of them are not circular). Finally, the much-occluded large circles can be obtained after masking out the small ones - even with the help of a distance transform. If the false circle hypothesis are desired to be eliminated, you can always reduce the Hough sensitivity. Or you could always render the contours of the circle and compare to the detected edges.

  • $\begingroup$ Thanks for the complete answer, Tolga! The ELSD algorithm really makes a difference here! I just have some more questions about how you arrived at this final image: how did you choose the thresholds when selecting the local maxima from the Circle Hough Transform? I'm trying a lot of different values for relative and absolute thresholds, but I'm getting either very few circles, or a lot of similar detected circles for the same balls. $\endgroup$
    – e.tadeu
    Apr 18, 2016 at 23:36
  • 1
    $\begingroup$ One thing I did was to cluster the similar centers together by averaging, so that they don't appear multiple times. This way you'll be less sensitive to the multiple peaks on the Hough transform. $\endgroup$ Apr 19, 2016 at 6:23
  • $\begingroup$ The ELSD link needs user: demo, password: demo $\endgroup$ Apr 20, 2016 at 13:23
  • $\begingroup$ The ELSD demo link didn't work for me directly (gave python errors) but going to it via ubee.enseeiht.fr/vision/ELSD worked. $\endgroup$
    – TripeHound
    Jan 2, 2018 at 12:23
  • $\begingroup$ Even though it's a couple of years old now, I still can't find any Python implementation of that ELSD method. $\endgroup$ Jul 24, 2018 at 6:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.