最快的边缘检测方法是什么?

发布于 2024-09-26 00:22:36 字数 511 浏览 7 评论 0原文

我正在考虑针对工业问题实施基于图像处理的解决方案。

该图像由一个红色矩形组成。在里面我会看到一个圆圈矩阵。要求是在以下约束下计算圆的数量。 (实际应用:数一下瓶壳里的瓶子数量。有没有漏瓶子???)

  1. 该操作所需的时间应该非常短。
  2. 我还需要检测红色矩形。我的目标是计算 包装内的物品没有 机制(传感器)来触发 相机。所以相机需要捕捉 照片不断,但 程序应该有办法丢弃 不必要的图像。
  3. 处理应该是实时的。
  4. 图像捕捉时可能存在“噪音”。您可能会看到椭圆形而不是圆形。

我的问题如下,

  1. 与给定匹配的最佳边缘检测算法是什么 场景?
  2. 除了边缘之外,我还可以使用其他机制吗? 检测?
  3. 我使用的语言和性能之间有很大的影响吗? 系统?

I am thinking of implement a image processing based solution for industrial problem.

The image is consists of a Red rectangle. Inside that I will see a matrix of circles. The requirement is to count the number of circles under following constraints. (Real application : Count the number of bottles in a bottle casing. Any missing bottles???)

  1. The time taken for the operation should be very low.
  2. I need to detect the red rectangle as well. My objective is to count the
    items in package and there are no
    mechanism (sensors) to trigger the
    camera. So camera will need to capture
    the photos continuously but the
    program should have a way to discard
    the unnecessary images.
  3. Processing should be realtime.
  4. There may be a "noise" in image capturing. You may see ovals instead of circles.

My questions are as follows,

  1. What is the best edge detection algorithm that matches with the given
    scenario?
  2. Are there any other mechanisms that I can use other than the edge
    detection?
  3. Is there a big impact between the language I use and the performance of
    the system?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

她如夕阳 2024-10-03 00:22:36

啊 - 您现在已经告诉我们瓶子位于固定位置!

这是一个非常简单的问题。

全部你要做的就是查看 12 个点中的每一个,看看那里是否有黑色区域。没有什么比这更容易的了。

您根本不需要进行任何边缘或形状检测。

就是这么简单。

然后你指出盒子可能会旋转,东西可能会摇晃。盒子可能会旋转一点(甚至很多,每次 0 到 360),这是很容易处理的。瓶子位于“槽”中(即使摇晃)这一事实极大地改变了问题的性质。您的主要问题(这很简单)是等待每个新的红色方块(板条箱)位于相机下方的中心。我刚刚意识到您在原来问题的句子中的字面意思是“矩阵”。与寻找无序的圆圈相比,这完全改变了一切。确定斑点是否在 12 个点之一“打开”,与“识别图像中的圆圈”是一个截然不同的问题。也许您可以发布一张图片来解决这个问题。


最后,我相信下面的 Kenny 已经确定了最佳解决方案:斑点分析。


“数一下瓶壳中的瓶子数量”...

各个瓶子是否位于“槽”中?即,有 4x3 = 12 个孔,每个瓶子一个。

换句话说,您“只需”确定 12 个孔中的每个孔中是否有瓶子。

这是正确的吗?

如果是这样,那么您的问题比“任何地方”一堆瓶子的更普遍的问题要容易得多。

很简单,我们从哪里看到瓶子?顶部、侧面、底部还是?我们是否总是看到顶部/底部,或者它们是混合的(即从上到尾包装)。这些问题造成了巨大的差异。

AHH - YOU HAVE NOW TOLD US THE BOTTLES ARE IN FIXED LOCATIONS!

IT IS AN INCREDIBLY EASIER PROBLEM.

All you have to do is look at each of the 12 spots and see if there is a black area there or not. Nothing could be easier.

You do not have to do any edge or shape detection AT ALL.

It's that easy.

You then pointed out that the box might be rotatated, things could be jiggled. That the box might be rotated a little (or even a lot, 0 to 360 each time) is very easily dealt with. The fact that the bottles are in "slots" (even if jiggled) massively changes the nature of the problem. You're main problem (which is easy) is waiting until each new red square (crate) is centered under the camera. I just realised you meant "matrix" literally and specifically in the sentence in your original questions. That changes everything totally, compared to finding a disordered jumble of circles. Finding whether or not a blob is "on" at one of 12 points, is a wildly different problem to "identifying circles in an image". Perhaps you could post an image to wrap up the question.


Finally I believe Kenny below has identified the best solution: blob analysis.


"Count the number of bottles in a bottle casing"...

Do the individual bottles sit in "slots"? ie, there are 4x3 = 12 holes, one for each bottle.

In other words, you "only" have to determine if there is, or is not, a bottle in each of the 12 holes.

Is that correct?

If so, your problem is incredibly easier than the more general problem of a pile of bottles "anywhere".

Quite simply, where do we see the bottles from? The top, sides, bottom, or? Do we always see the tops/bottoms, or are they mixed (ie, packed top-to-tail). These issues make huge, huge differences.

顾挽 2024-10-03 00:22:36

Surf/Sift = 矫枉过正,在这种情况下你当然不需要它。

如果您想要实时速度(在 800x600 图像上大约 20fps+),我建议使用 Cuda 来实现边缘使用标准过滤方案(例如 sobel)进行检测,然后实施二值化 + 图像闭合以确保圆的边缘不会被分割开。

最难的部分是拟合圆。假设您已经到达获取边缘并确保它们使用图像闭合(形态学)连接的步骤。此时,我将按如下步骤进行:

  1. 运行 斑点​​分析/连接组件来分割出不接触的圆圈。如果圆圈可以接触,那么下一步
  2. 对于每个连接的组件/blob 使用 RANSAC 可以实时运行(与霍夫变换相反,我认为霍夫变换非常很难实时运行。)

如果您不能,第 2 步将更加困难将形成圆圈的连接组件分开,因此应该额外考虑如何保证该条件。

祝你好运。

编辑

经过更多思考,我觉得 RANSAC 非常适合圆形连接组件接触的情况。假设 RANSAC 应该仅将圆拟合到连接组件的一部分(因为它能够在大多数异常点的情况下表现良好)。这意味着您可以添加额外的检查来查看拟合的圆是否包含整个连接的组件组件,如果没有,则对连接组件中遗漏的部分重新运行 RANSAC。冲洗并根据需要重复多次。

我还意识到我说的是圆形,但您可以使用 RANSAC 轻松拟合椭圆而不是圆形。

另外,我想评论一下,当我说 CUDA 是一个不错的选择时,我的意思是 CUDA 是实现索贝尔滤波器 + 二值化 + 图像闭合的不错选择。连接组件和 RANSAC 可能最好留给 CPU,但您可以尝试将它们推到 CUDA 上,尽管我不知道 GPU 相对于 CPU 会给您带来多少优势。

Surf/Sift = overkill in this case you certainly don't need it.

If you want real time speed (about 20fps+ on a 800x600 image) I recommend using Cuda to implement edge detection using a standard filter scheme like sobel, then implement binarization + image closure to make sure the edges of circles are not segmented apart.

The hardest part will be fitting circles. This is assuming you already got to the step where you have taken edges and made sure they are connected using image closure (morphology.) At this point I would proceed as follows:

  1. run blob analysis/connected components to segment out circles that do not touch. If circles can touch the next step will be trickier
  2. for each connected componet/blob fit a circle or rectangle using RANSAC which can run in realtime (as opposed to Hough Transform which I believe is very hard to run in real time.)

Step 2 will be much harder if you can not segment the connected components that form circles seperately, so some additional thought should be invested on how to guarantee that condition.

Good luck.

Edit

Having thought about it some more, I feel like RANSAC is ideal for the case where the circle connected components do touch. RANSAC should hypothetically fit the circle to only a part of the connected component (due to its ability to perform well in the case of mostly outlier points.) This means that you could add an extra check to see if the fitted circle encompasses the entire connected component and if it does not then rerun RANSAC on the portion of the connected component that was left out. Rinse and repeat as many times as necessary.

Also I realize that I say circle but you could just as easily fit an ellipse instead of circles using RANSAC.

Also, I'd like to comment that when I say CUDA is a good choice I mean CUDA is a good choice to implement the sobel filter + binirization + image closing on. Connected components and RANSAC are probably best left to the CPU, but you can try pushing them onto CUDA though I don't know how much of an advantage a GPU will give you for those 2 over a CPU.

虫児飞 2024-10-03 00:22:36
  • 对于圆,尝试霍夫变换。
  • 其他机制:不知道
  • 编译语言可能会更快。
  • For the circles, try the Hough transform.
  • other mechanisms: dunno
  • Compiled languages will possibly be faster.
冷了相思 2024-10-03 00:22:36

SIFT 对圆形物体应该有很好的响应 - 它已获得专利, 尽管。 GLOH是类似的算法,但不知道是否有任何实现随时可用。

实际上,做一些更多的研究, SURF 是 SIFT 的改进版本,具有相当的有一些可用的实现,请查看维基百科页面上的链接。

SIFT should have a very good response to circular objects - it is patented, though. GLOHis a similar algorithm, but I do not know if there are any implementations readily available.

Actually, doing some more research, SURF is an improved version of SIFT with quite a few implementations available, check out the links on the wikipedia page.

一向肩并 2024-10-03 00:22:36
  1. 颜色总和+凸包来检测边界。您主要需要矩形的 4 个角,而不是它的边?
  2. 没有运动,没有第二个相机,一点选择 - 针对一点输入(颜色直方图,颜色分布矩阵)的大量数学方法。不知道。
  3. Java == 高内存消耗,Lisp == 高脑消耗,C++ == 内存/CPU/速度/大脑使用最佳。
  1. Sum of colors + convex hull to detect boundary. You need, mostly, 4 corners of a rectangle, and not it's sides?
  2. No motion, no second camera, a little choice - lot of math methods against a little input (color histograms, color distribution matrix). Dunno.
  3. Java == high memory consumption, Lisp == high brain consumption, C++ == memory/cpu/speed/brain use optimum.
思念绕指尖 2024-10-03 00:22:36

如果对比度良好,blob 分析 就是适合该作业的算法。

If the contrast is good, blob analysis is the algorithm for the job.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文