使用FFT进行模板匹配 [英] Template Matching using FFT

查看:306
本文介绍了使用FFT进行模板匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以解释如何使用FFT执行模板匹配.模板小于原始图像. 1.在任何地方都声明必须用零填充模板.怎么做的.是将其添加到图像的底部和右侧,还是均匀地添加到整个图像周围.

Can anyone please explain how to perform template matching using FFT. The template is smaller than the original image. 1. Everywhere it states that the template has to be padded with zeros. How it is done. Is it added to the bottom and right of the image or equally around the entire image.

谢谢.

推荐答案

您正在使用傅立叶变换来计算互相关.就这么简单.

You are using the Fourier Transform to calculate the cross correlation; it's as simple as that.

围绕模板的所有侧面执行填充.这是因为标准的快速傅里叶变换只能在2 ^ n大小的数据大小上运行,因此模板和图像的大小必须为2 ^ n * 2 ^ n.由于通常不是这样,因此可以通过在外部填充零来调整模板的大小以满足此要求.这些零对FFT计算没有影响.

Padding is performed around all sides of the template. This is because a standard Fast Fourier Transform can only operate on data sizes that are 2^n in size therefore your template and the image need to be 2^n * 2^n in size. Since it usually isn't, the template is resized to meet this requirement by padding the outside with zeros. These zeros have no effect on the FFT calculation.

考虑使用相位相关,额外的工作量很小,您可以获得很好的结果.

Consider using phase correlation, the extra effort is very small and you can get great results.

这篇关于使用FFT进行模板匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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