File Exchange Pick of the Week

Our best user submissions

检测圈子,重新审视

Brett‘s Pick this week iscircleFinder, an app for, well, finding circles in images.

Many of you know already that I am a big fan of apps–those that are built into MathWorks toolboxes, and ones that I build myself. I do a tremendous amount of image and video processing, and know my way around the functionality of the Image Processing Toolbox pretty well. Still, finding the “best” set of parameters for some of our functions can be challenging–even for a seasoned user.

例如,考虑在图像中查找圆圈的任务。这个话题经常出现 - 来自不同领域的图像。圆检测实际上是如此普遍,我选择了Tao Peng’s circle detector(CircularHough_Grd) as a Pick of the Week back in 2008. At the time, it was one of the one of the best implementations ofcircular Hough transformsthat I could find.

In the nine years since I wrote about Tao’s File Exchange submission, the Image Processing Toolbox team hit a home run with their release of our own version of a (Hough) circle detector, with a function calledimfindcircles. Because of that function, detecting circles today is even easier–and faster than ever before!

但是,查看文档imfindcircles, you can imagine that it can be difficult to find the working parameters for detecting challenging circles.

文档('imfindcircles')

有两个所需的输入参数(图像,半径或目标圆的半径范围)和四个输入参数值对:

  1. ‘ObjectPolarity’, with which we indicate whether whether the circular objects are brighter or darker than the background;
  2. “方法”,指定用于计算蓄能器数组的技术;
  3. “灵敏度”,以指定对圆形霍夫转换蓄能器阵列的灵敏度;和
  4. “ Edgethreshold”,为确定图像中的边缘像素设定了梯度阈值。

We can readily use theimdistlinetool to measure the radii. And of course we can (usually) ascertain the ‘ObjectPolarity’ just by visual inspection. But what about the other parameters?

img = imread('coins.png');[centers, radii, metric] = imfindcircles(img, [20 30],...'ObjectPolarity','明亮的');IMShow(IMG)Viscircles(中心,半径);

That detection worked beautifully with default input parameters. But say we wanted to detect (and count) cells in this blood-smear image from the Centers for Disease Control (CDC)?

img = imread('Babesia_thin_giemsa_tetrad4.jpg');[centers, radii, metric] = imfindcircles(img, [20 30],...'ObjectPolarity','黑暗的');IMShow(IMG)Viscircles(中心,半径);

Default parameters fail entirely!

这就是CircleFinder应用程序所在的地方:

Check out this video showing it in action!

Give it a try next time you need to detect circles. If you like it, you can even安装应用程序in your Apps Toolbar. And make sure you check outValerie’s really nice video在工具上!

As always, I welcome your思想和评论.

与Matlab®R2017A一起出版

|
  • print
  • send email

注释

To leave a comment, please click这里to sign in to your MathWorks Account or create a new one.