it can happen that getting to know which circle is on top can be very tricky if there just overlapping on the edge:
And since the outer most loop in the algorithm goes through the circles at random, there can be miss-labeled circles in some cases.
Using the 90% of the circle diameter as distance threshold seems to work better, since it does not cluster together some circles that are just overlapping on the edge. Note that the circle detection is not perfect and the real edge is not exactly the detected edge.
it can happen that getting to know which circle is on top can be very tricky if there just overlapping on the edge:
And since the outer most loop in the algorithm goes through the circles at random, there can be miss-labeled circles in some cases.
Using the 90% of the circle diameter as distance threshold seems to work better, since it does not cluster together some circles that are just overlapping on the edge. Note that the circle detection is not perfect and the real edge is not exactly the detected edge.