模板匹配-模板和图像尺寸不同
我有一张图像,我可以以更好的质量(例如更大的尺寸)获得该图像。问题是我无法在默认尺寸上进行模板匹配,只能在更高的尺寸上进行模板匹配。较高的值不是固定的 - 它可以是原始图像的 1.0 到 2.5 倍之间的任何值。
我正在考虑以更高分辨率检索模板,然后根据图像的大小调整模板的大小。但是,当我使用不同的调整大小算法时,这可能会产生完全错误的结果。
你有什么建议?当我想在这种情况下进行模板匹配时,我应该如何进行?
编辑:请注意 - 模板将始终相同,并且图像中的对应项也相同(图像是计算机生成的)。
I have an image, which I can obtain at better quality (e.g. higher size). The problem is that I can't do template match on default size, only on a higher one. And the higher one is not fixed - it can be anything from 1.0 to 2.5x of original image.
I was thinking of retrieving templates in higher resolution and then depending on what's the size of the image, resize down the templates. However, that might yield completely wrong results, when I use different resize algorithm.
What do you suggest? How should I proceed, when I want to do template matching in such circumstances?
Edit: Just note - templates will always be the same and their counterparts in images too (images are computer-generated).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
那么你是说你有一个标称比例为 1.0 的图像模板和你想要匹配范围从 1.0 到 2.5x 的目标图像?
尺度不变模式匹配算法非常复杂。最简单的方法是将目标图像缩小到多个中间分辨率,并尝试将其与模板匹配。为了获得更好的性能,请尝试减小模板的比例(例如 0.5),以便您的目标落在 0.5-1.75 范围内。使用不同分辨率时,请尝试稍微平滑图像。
最后,为了确保模板匹配准确,请增加目标图像的比例,并跟踪最后一个 {x, y} 位置的模板图像直至新的分辨率。您可以这样做,直到获得最大的分辨率。归一化灰度相关性是一种非常好的且快速的模式匹配算法。
So are you saying you have an image template at nominal scale of 1.0 and target image in which you want to match ranging from 1.0 to 2.5x?
Scale invariant pattern matching algorithms are pretty complex. The simplest thing to do is to scale down your target image to multiple intermediate resolutions and try to match it with your template. For better performance, try to reduce the scale of your template (say 0.5) so that your target will fall in the 0.5-1.75 range. When working on different resolutions, try to smooth your images a bit.
Finally to make sure your template match is accurate, increase your scale of your target image and template image tracking the last {x, y} position up to your new res. You can do this until greatest resolution is attained. Normalized grayscale correlation is a pretty good and fast algo for pattern matching.