File Exchange Pick of the Week

Detecting circles in images, revisited

Posted by Brett Shoelson,

This week, Brett revisits the historical quest for a circle detection algorithm, and pays tribute to the File Exchange files and authors that led to MathWorks' to offer our own officially supported circle detection algorithm.

I’ve been supporting MATLAB users as an application engineer for nearly 10 years now, and writing about files on the MATLAB Central File Exchange for nearly as long. In my role at MathWorks, I get to talk to people frequently about how they use our tools, and about how they would like to use our tools in ways that are not “officially” supported. It's part of my job to feed that information back to our developers, and it helps them to decide where they should be spending their development efforts.

Back in May, 2008, I wrote about the difficulty of detecting circles in images using MATLAB; people asked for that capacity often, but we had no in-product tools to facilitate that detection process. Tao Peng's File Exchange submission was my go-to recommendation whenever customers asked.

Partly because you asked so often, and partly because Tao's solution was so popular, we finally introduced in 2012 a couple of different Hough transforms for circle detection; if you haven't used it, imfindcircles now makes easy work of the difficult task of finding circles in images.

If you need to detect circles in images, and if you have the Image Processing Toolbox, imfindcircles will be your friend; it's fast, and flexible. (I haven't seen a robust solution that works independently of that Toolbox. Correct me, please, if I've overlooked something.)

Also, if you have a compelling use case for a generalized Hough transform--for detecting shapes in images other than circles or lines--please add a comment below to let us know!

In the meantime, try out FindCirclesGUI if you haven't already done so; it allows you to change any of the input parameters to imfindcircles, and to interactively see the results:

As always, I welcome your thoughts and comments.


Get the MATLAB code

Published with MATLAB® R2014a

Comments are closed.

These postings are the author's and don't necessarily represent the opinions of MathWorks.