开发者

Template match - different sizes of template and image

开发者 https://www.devze.com 2023-02-18 20:52 出处:网络
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

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 migh开发者_如何学运维t 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).


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消