I have an image that has pixelated circles in it (a cross section of wires). I want to identify the wires, their location and count them.

The circles never overlap and the wires are all within a 95% radius. However the spacing might not be exact as there can be gaps between the wires.

What is a good way to find the geometric mean of the group of pixels that represent a wire?

enter image description here
The above picture is what I would like to do, to fit a circle to a group of pixels (which I did using paint). I would think that the first step is to find the geometric mean of the group.

I did try using a tophat kernel and threshold to emphasize the centers, but I end up with a few pixels and no center pixel. I need to identify the center and end up with only one pixel which is difficult to do with thresholding since the pixel values differ in brightness. enter image description here

Raw picture: enter image description here

  • $\begingroup$ Can you post a raw picture? $\endgroup$ – Tolga Birdal Oct 4 '17 at 23:14
  • $\begingroup$ Yep, its small though $\endgroup$ – laptop2d Oct 4 '17 at 23:32
  • $\begingroup$ This is too low res. Why do you work with such an image? $\endgroup$ – Tolga Birdal Oct 4 '17 at 23:58

1) Normalize your image to range $[0,255]$.

2) Select a threshold and threshold the image. For your image, what worked is: $\tau=[140-150]$.

3) Compute a Euclidean distance transform.

4) Apply watersheds segmentation.

If I apply this procedure, here is what I get: enter image description here

Not perfect, but maybe a good start. The result looks similar to performing a Voronoi diagram on a smoothed/noise filtered version of the image.

Now to each region, one could fit a circle, using any algorithm (edge extraction and fitting or Hough transform etc.) For now, I used a simple circle fitting to the edges:

enter image description here

Again, not the best, but could be a sufficient starting point.

I also think that you would find the following useful:

Segmentation Methods for Light Microscope Image

Detecting Spheric Particles


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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