Better results with Canny/Hough for circular particles

37 views
Skip to first unread message

Adam Hughes

unread,
Dec 13, 2013, 2:47:44 PM12/13/13
to scikit...@googlegroups.com
Hi,

I have several images of circular particles (see attached for an example) and I've been experimenting with automatic routines to find edges.

I've found that with Canny, I can get really nice edges, but the edges are not always connected.  Thus, when I do fill-binary, many of my particles are not painted in due to slight breaks in the border returned by canny.  Is there an ideal way to fix this, either by connecting "almost" connected canny edges?  Additionally, what is the best way to filter out small fragments and/or non-circular edges?

I've attached an image of the canny outlines; you can see that I obviously want to get rid some of the regions that aren't associated with any particles.  PS, the coloring of the outlines are based on the brightness of the image at that point underneath it, which has been hidden.  (Would be happy to share the function if anyone wants it).

Lastly, I tried adapting the circular hough transform example:


But struggled with setting it up, due to a naive understanding of the algorithm.  Given that my image has thousands of particles, but I know roughly the size distribution, would the circular hough transform be useful to me?

Thanks


aunps.png
canny.png

Dan Farmer

unread,
Dec 13, 2013, 3:03:30 PM12/13/13
to scikit...@googlegroups.com
Hi Adam,

This can be the worst part of image processing, but I'm curious how
much you played with the parameters to Canny? You probably know this,
but canny already tries to close gaps (hysteresis thresholding). What
you want to do is try to lower the low_threshold parameter (values
above the high threshold value get initially labeled as edges, then it
looks for pixels that are connected to edge pixels and whose value is
> low_threshold to link the edges).

An easy/basic way to get rid of small fragments would be to start with
morphological erosion.

-Dan
> --
> You received this message because you are subscribed to the Google Groups
> "scikit-image" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to scikit-image...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Adam Hughes

unread,
Dec 13, 2013, 3:25:53 PM12/13/13
to scikit...@googlegroups.com
Hi Dan,

Thanks for the quick reply.

I think that I can get better results if I tweak the parameters.  The threshold parameter intuitively makes sense, but I'll have to read a bit to get familiar with sigma and the algorithm in general.  Thanks for the explanation; it really helped.  I will try out the erosion as well.

PS, do you have any feelings towards the applicability of circular hough to my image?

Johannes Schönberger

unread,
Dec 13, 2013, 4:32:40 PM12/13/13
to scikit...@googlegroups.com
Hi,

do you really need the edges or what is the actual purpose? Maybe there are better methods other than canny to achieve it...

Adam Hughes

unread,
Dec 13, 2013, 6:09:02 PM12/13/13
to scikit...@googlegroups.com
I'm trying multiple methods for isolating nanoparticles for a paper in which the purpose will be to contextualize a lot of available image processing workflows best suited for sizing, separating and counting nanoparticles.  The idea is that imaging nanoparticles is becomes a widely standard necessity, and so I want to present an overview of the availble methods and workflows for best processing images, as well best practices for obtaining high quality images in the lab via SEM/AFM.

I've already covered approaches via auto thresholding, with optionally applying watersheding to find particle boundaries. 

IMO, Canny, Hough, Sobel etc... give another approach; whereby, one finds and deals directly with the particle boundaries/outlines.  The advantage of this approach is that it lends finer control over the particle boundaries, which are often hazy in SEM images.  I think that there are some use cases for this approach.  For example, I've observed that canny edge detection gives a great fit to particles that have a halo effect, and so I'm pretty confident that, if we could fill all of the edges, that we'd be sizing the particles very nicely.  It's easier to assess the "goodness of fit" looking at just the edges, but obviously it introduces more work.  I at least had hoped to present a bit of this edge --> filter ---> fill approach in the paper to complement the threshold approaches to segmentation.

I tried the morphological operators (open, close, dilation, edge), but they are a bit restrictive.  I'd need something that has a variable structure parameter, as Dan mentioned sort of is builtin to canny (ie, it's smart about how it closes the regions).  I'll probably just leave it at "the input parameters are crucial for getting closed regions" instead of focusing on how to connect the regions after the fact.

PS, is anyone familiar with a function in scikit or ndimage to give the perimeter/outline of a filled region?  

Thanks

You received this message because you are subscribed to a topic in the Google Groups "scikit-image" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scikit-image/9U46IbLV90A/unsubscribe.
To unsubscribe from this group and all of its topics, send an email to scikit-image...@googlegroups.com.

Johannes Schönberger

unread,
Dec 14, 2013, 3:43:41 AM12/14/13
to scikit...@googlegroups.com

Am 14.12.2013 um 00:09 schrieb Adam Hughes <hughes...@gmail.com>:

> I'm trying multiple methods for isolating nanoparticles for a paper in which the purpose will be to contextualize a lot of available image processing workflows best suited for sizing, separating and counting nanoparticles. The idea is that imaging nanoparticles is becomes a widely standard necessity, and so I want to present an overview of the availble methods and workflows for best processing images, as well best practices for obtaining high quality images in the lab via SEM/AFM.
>
> I've already covered approaches via auto thresholding, with optionally applying watersheding to find particle boundaries.

OK, segmentation would have been my first suggestion.

> IMO, Canny, Hough, Sobel etc... give another approach; whereby, one finds and deals directly with the particle boundaries/outlines. The advantage of this approach is that it lends finer control over the particle boundaries, which are often hazy in SEM images. I think that there are some use cases for this approach. For example, I've observed that canny edge detection gives a great fit to particles that have a halo effect, and so I'm pretty confident that, if we could fill all of the edges, that we'd be sizing the particles very nicely. It's easier to assess the "goodness of fit" looking at just the edges, but obviously it introduces more work. I at least had hoped to present a bit of this edge --> filter ---> fill approach in the paper to complement the threshold approaches to segmentation.
>
> I tried the morphological operators (open, close, dilation, edge), but they are a bit restrictive. I'd need something that has a variable structure parameter, as Dan mentioned sort of is builtin to canny (ie, it's smart about how it closes the regions). I'll probably just leave it at "the input parameters are crucial for getting closed regions" instead of focusing on how to connect the regions after the fact.
>
> PS, is anyone familiar with a function in scikit or ndimage to give the perimeter/outline of a filled region?

skimage.measure.regionprops, skimage.measure.perimeter

Adam Hughes

unread,
Dec 14, 2013, 4:01:34 AM12/14/13
to scikit...@googlegroups.com

Thanks for the help!

Reply all
Reply to author
Forward
0 new messages