有没有一种算法可以在 opencv 中匹配比例和旋转 rotateRect

Is there an algorithm where I can match scale and rotation rotateRect in opencv

我有一个模板图像,白色背景和黑色形状 it.I 还有一个形状相似但旋转和比例不同的图像,image.Just 中也有一些噪点图片如下!我想使用 rotateRect 获取包含模板形状的 Rect,并使用模板查找包含目标的 rotateRect sharp.I 知道 matchTemplate() 不好当对象在 scene.So 中旋转或缩放时,我尝试使用 matchShapes() function.But matchShapes() 函数用于比较两个 contours.So 可以看到目标图像中的形状,形状是混合了噪声斑点,我无法分割目标形状和噪声。当我在目标图像中使用 findContours 时,我想得到一个只包含目标形状而不是噪声的 rotateRect blob.But,我发现的轮廓将包含目标形状和 noise.As 结果我不能
找到目标 shape.How 我可以使用模板 rotateRect 来找到目标吗 opencv 中的 rotateRect?你能提前分享你的 idea.Thanks 吗!!

考虑到这种情况,您可以尝试根据颜色对图像进行分割,因为您感兴趣的对象是黑色的,噪声是蓝色的。然后,您可以继续使用基于轮廓的方法来寻找您的目标。你可以参考这个 link 来实现 OpenCV:Watershed algorithm

你也可以参考这个 SO link Coca-Cola can shape recognition.