Template Matching using FFT

谁说我不能喝 提交于 2019-12-25 03:50:11

问题


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.

Thanks in advance.


回答1:


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

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.




回答2:


The chapters 3 and 4 of Gonzalez and Woods, "Digital Image Processing" should help you acquire a better understanding of the theory.

You need to perform a correlation between your image and your template. In some cases, it may be more efficient to perform this correlation in the frequency domain (using FFT), while in others you would want to perform the operation in the spatial domain.

Some software systems make this choice transparent to the users. See for example the function ImageCorrelate in Mathematica (http://reference.wolfram.com/mathematica/ref/ImageCorrelate.html).




回答3:


Here's a great resource, that answers your question and a bunch of related tradeoffs.



来源:https://stackoverflow.com/questions/6944775/template-matching-using-fft

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!