Hough Circle Transform remove "touching" circles

Hei all,

I am analyzing bubbles of milk foam and would like to measure the diameter and distribution of each bubble.
Starting image:

I run the following code first.

open(File.openDialog("Select image..."));
run("Size...", "width=1000 height=750 depth=1 constrain average interpolation=Bilinear");
run("Pseudo flat field correction", "blurring=50");
run("Subtract Background...", "rolling=100 light");
//makeRectangle(50, 50, 900, 600);
makeRectangle(400, 300, 300, 300); // only to speed up the process and test the features
setOption("BlackBackground", true);

setAutoThreshold("Default dark");
setOption("BlackBackground", true);
run("Convert to Mask");

run("Find Edges");
setOption("BlackBackground", true);
run("Make Binary");

After the first code I get the following image (image left is the cropped one, right after the whole code):
A2207_1_1-crop => A2207_1_1-1

Now I am using the Hough Circle Transform plugin.

run("Hough Circle Transform","minRadius=7, maxRadius=100, inc=1, maxCircles=65535, threshold=0.5, resolution=656, ratio=1.0, reduce show_mask results_table");

The main problem is, that I get a lot of overlapping circles.


  1. What is the best way to remove the overlapping circles?
    I would like to remove all the “kissing” circles.
  2. Do you think this is in general a good approach? (I am a rookie :smiley:)

Thank you very much.


1 Like

A few things to try would be to increase the minimum circle radius and increase the minimum Hough score. A full description of the search parameters can be found here: https://imagej.net/Hough_Circle_Transform#Search_Parameters

Some times it can be helpful to search exclusively for the larger circles first, then crop them out from the image, and continue searching for smaller and smaller circles. This is because the larger the circle, the less likely it is to have a high Hough score, so dividing the search into ranges of radii can help.

Ben Smith