Converting blobs to circles I have this binary image with some blobs of random sizes.


I would like to convert the blobs into circles of uniform diameter. it doesn't really matter what diameter but they need to be circles and uniform.
Here is what I am looking for.



I am working with tiff sequences in ImageJ. I tried erosion and dilation. I tried Ultimate point to reduce to a point and then dilate up but that creates a square. I tried distance map but didn't get very far. Although i am pretty sure distance map is the way to go. None of my current approaches are satisfactory.

If I could do

   #pseudo-code
   if area(blob) &gt; x
   then make circle(diameter=y)
   else remove blob


would be even better.

If anyone has a solution using ImageJ or Python SciPy or even R, please let me know. I would very much appreciate that. Thanks.
Here is the procedure to follow:


Threshold your image
Obtain connected components - each distinct blob in the image gives you a component.
For each component, find the boundary pixels. Each boundary is represented as a set of points.
Fit one circle per each boundary point set. You could use a simple least squares fitting.


This should give you pretty good circles. You could do this in many languages, using the standard image processing libraries.