将曲线图案与图像的边缘匹配 [英] Matching a curve pattern to the edges of an image

查看:188
本文介绍了将曲线图案与图像的边缘匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个目标图片要搜索沿其边缘的曲线和包含曲线的模板图像。我需要实现的是找到目标图像内的模板图像中的曲线的最佳匹配,并且基于分数来找出是否存在匹配。这也包括曲线的旋转和大小调整。

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.

我考虑使用OpenCV(通过使用Python或Processing / Java或者如果这些有限的访问所需的功能,然后通过使用C)使事情实用和高效,但无法找出是否我可以使用任何功能(或他们的组合)在OpenCV,可用于做这项工作。我一直在阅读OpenCV文档,并认为Contours可以做这项工作,然而所有的例子显示封闭的形状,而不是我的情况,我需要匹配一个开放的曲线到边缘的一部分。

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.

因此,有没有办法通过使用OpenCV或任何已知的代码或算法,你会建议?

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:

推荐答案

我的第一个想法是广义霍夫变换< a>。但是我不知道有什么好的实现。

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

我会在canny edge图像上首先尝试SIFT或SURF。它通常用于找到2d区域,而不是1d轮廓,但如果你采取最小的边界框围绕你的轮廓,并使用它作为搜索模式,它应该工作。

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有一个实现:
Features2D +查找已知对象的同位图

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.

另请参阅Stackoverflow的回答:
可口可乐的算法改进可以形状识别

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

这篇关于将曲线图案与图像的边缘匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆