OpenCV中的旋转和尺度不变模板匹配 [英] Rotation and scale invariant template matching in OpenCV

查看:5413
本文介绍了OpenCV中的旋转和尺度不变模板匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

缩放和旋转模板匹配

我有一个模板灰度图象,有白色背景和黑形状在它。我也有几个类似的测试图像,旋转和形状不同。测试图像与模板不同,但它们是相似的。

I have a template grayscale image , with white background and black shape over it. I also have several similar test images which vary in rotation and in shape. The test images are not same as template but they are similar.

我想比较这两个图像,看看模板匹配,最类似,任何测试图片。在图像中没有失真,没有噪声和没有其他缺陷。

I want to compare these two images and see if template matches , is most similar to, any of the test images. There are no distortions , no noise and no other defects in the images. Are there any tutorials on this topic ?

推荐答案

首先尝试最简单的方法。

Try the easiest method first.

如果我正确地理解你,你有一些模型 - 在白色背景的黑色形状。你可以把它当作blob - 通过计算主轴角度找到它的质心和旋转 - 看

If I understand you correctly you have some model - black shape over white background. You can treat it as blob - find it's mass center and rotation by computing principal axes angle - look there.

然后您必须从其他图片中分割形状。然后尝试使用matchShapes()函数查找最佳对应形状 - 请参见 如何使用它。

Then you must segment out shapes from other images. Then try to find the best corresponding shape with matchShapes() function - see there how to use it.

matchShapes()函数使得缩放和旋转不变量匹配。

扩展您的问题,您可以找到最佳匹配blob的质心和旋转,找到旋转,缩放和位移您的模型和匹配的图片。

Extending your question you can find mass center and rotation of best matching blob and find rotation, scale and displacement between your model and matched image.

这篇关于OpenCV中的旋转和尺度不变模板匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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