有一个算法,我可以匹配缩放和旋转rotateRect在opencv [英] Is there an algorithm where I can match scale and rotation rotateRect in opencv

查看:2307
本文介绍了有一个算法,我可以匹配缩放和旋转rotateRect在opencv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个模板图像,白色的背景和黑色的形状在它。我也有一个类似的形状,但在不同的旋转和规模,也有一些噪声在图像中的图像。就像图片如下! img src =https://i.stack.imgur.com/G5ebI.jpgalt =enter image description here>我想使用rotateRect获取一个矩形,其中包括模板形状,并使用模板查找一个rotateRect包括目标sharp.I已知的matchTemplate()是不好的,当对象在场景中旋转或缩放。我尝试使用matchShapes()function.But matchShapes()函数用于与两个轮廓比较。可以看到目标图像中的形状,形状与噪声blob混合,并且我不能分割目标形状和噪声。我想得到一个rotateRect只包括目标形状不是噪音blob.But当我使用findContours在目标图像,我发现的轮廓将包括目标形状和噪声。因此,我不能

找到目标形状。我如何使用模板rotateRect找到目标
rotateRect在opencv?你能分享你的idea.Thanks在进步!!

I have a template image , with white background and black shape over it.I also have an image which have a similar shape but in different rotation and scale,also have some noise in image.Just like the pic as follow!I want to use a rotateRect to get a Rect which includes the template shape and use the template to find a rotateRect which includes the target sharp.I have known matchTemplate() is not good when object is rotated or scaled in scene.So I try to use matchShapes() function.But matchShapes() function is used to compare with two contours.So can see the shape in target image,the shape is mixed with noise blob and i can't segment the target shape and noise. I want to get a rotateRect which just includes target shape not noise blob.But when i use findContours in target image,the contour which i found will include target shape and noise.As a result I can't
find the target shape.How can i use template rotateRect to find a target rotateRect in opencv?Can you share your idea.Thanks in advances!!

推荐答案

考虑到场景,您可以尝试基于颜色分割图像,因为您感兴趣的对象是黑色的,噪点是蓝色的。然后,您可以继续使用基于轮廓的方法来查找目标。您可以参考此链接的实施 OpenCV:流域算法

Considering the scenario, you can try segmenting the image on the basis of color since your object of interest is black and noise is blue in color. Then, you can proceed with the contour based approach for finding your target. You can refer this link for implementation OpenCV:Watershed algorithm

您也可以参考这个SO连结可口可乐可以形状识别

You can also refer this SO link Coca-Cola can shape recognition.

这篇关于有一个算法,我可以匹配缩放和旋转rotateRect在opencv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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