匹配的曲线图案,以图象的边缘图象、曲线、图案、边缘

2023-09-11 03:06:10 作者:透支的狂 beast-

余有要搜索的沿其边缘的曲线和包含曲线的模板图像中的目标图像。我需要实现的是发现,在目标图像中的模板图像的曲线的最佳匹配,并根据得分,以找出是否存在匹配或没有。还包括旋转的曲线和调整大小。目标图像可以是Canny边缘检测器的输出,如果使事情变得更容易。

我正在考虑使用OpenCV的(通过使用Python或加工/ Java或如果这些很少有机会到所需要的功能,然后用C),以使事情实用,高效的,但是找不到了,如果我可以使用任何功能(或它们的组合),它们可用做这个工作在OpenCV中。我一直在读通过OpenCV的文档,并在第一次的轮廓可以做这个工作想,但是所有的例子表明封闭的形状,而不是我的情况,我需要一个开放的曲线匹配到边缘的一部分。

那么,有没有一种方法可以通过使用OpenCV的或与任何已知的code或算法,你会认为这样做呢?

下面是一些图片来说明这个问题:

解决方案

我的第一个念头是广义Hough变换。不过,我不知道有什么好的实现了。

我会尝试精明的边缘图像SIFT或SURF第一。它通常用于查找2D领域,而不是一维的轮廓,但如果你把最小的边框周围的轮廓,并用其作为搜索模式,它应该工作。

OpenCV的该实施: Features2D +单应寻找

有一个问题可能会得到一个很好的边缘图像,那些黑色的形状在后面可能会分散注意力。

另请参阅该#1的答案: 算法改进可口可乐可以塑造识别

曲线y 9 x2的图像怎么画

I have a target image to be searched for a curve along its edges and a template image that contains the curve. What I need to achieve is to find the best match of the curve in the template image within the target image, and based on the score, to find out whether there is a match or not. That also includes rotation and resizing of the curve. The target image can be the output of a Canny Edge detector if that makes things easier.

I am considering to use OpenCV (by using Python or Processing/Java or if those have limited access to the required functions then by using C) to make things practical and efficient, however could not find out if I can use any functions (or a combination of them) in OpenCV that are useable for doing this job. I have been reading through the OpenCV documentation and thought at first that Contours could do this job, however all the examples show closed shapes as opposed to my case where I need to match a open curve to a part of an edge.

So is there a way to do this either by using OpenCV or with any known code or algorithm that you would suggest?

Here are some images to illustrate the problem:

解决方案

My first thought was Generalized Hough Transform. However I don't know any good implementation for that.

I would try SIFT or SURF first on the canny edge image. It usually is used to find 2d areas, not 1d contours, but if you take the minimum bounding box around your contour and use that as the search pattern, it should work.

OpenCV has an implementation for that: Features2D + Homography to find a known object

A problem may be getting a good edge image, those black shapes in the back could be distracting.

Also see this Stackoverflow answer: Algorithm improvement for Coca-Cola can shape recognition