1

Is Template Matching using FFT more efficient if the source and template images are gray-scale images?

Also, let me piggy back. Does any one know of an excellent tutorial to implement Template matching using Fast Fourier Transforms?

Thanks.!

peterd
  • 99
  • 9
  • What do you mean by more efficient? Working in greyscale you have less data to process, but less data for information. – YXD Feb 13 '13 at 11:52
  • With Efficient, I mean, would match detection be more accurate if I am inputting both the images as gray-scale images or vice-versa? Also, would converting input color images to gray-scale images for template matching make sense? – peterd Feb 13 '13 at 23:17

1 Answers1

3

Re excellent tutorial: J.P "Zilla" Lewis's paper on Fast Normalized Cross-Correlation is hard to beat. Truly a classic.

Francesco Callari
  • 11,300
  • 2
  • 25
  • 40
  • I read the paper, Thanks, but implementing the NCC equation without FFT (meaning NCC in spatial domain) doesn't seem to work. Any thing that I would have missed? I know that's a vague question but this might be an easy take for any pros out here. – peterd Feb 15 '13 at 00:07
  • What do you mean by "doesn't seem to work"? Does not work for your imagery? Have you tested your implementation it with a simple pattern, shifting it by a known amount? – Francesco Callari Feb 15 '13 at 03:07
  • Well it wasn't working because of a silly error. Its working fine in spatial domain. But I am finding it hard to do the correlation in freq. domain with my very limited knowledge. I mean I didn't understand what J.P.Lewis is trying to explain in the above mentioned resource. Any other pointers that I could use? – peterd Mar 04 '13 at 05:58
  • J.P. Lewis is saying two things: (1) that computing it in the frequency domain is theoretically more efficient, and practically so when the size of the pattern and search region are more than a few tens of pixels and (2) He is spelling out step by step how to do it. After reading a bit about the property of the Fourier transform, you ought to be able to implement his algorithm in a couple of hours of coding and testing, taking advantage of a library such as fftw (http://en.wikipedia.org/wiki/FFTW) to compute the transforms themselves. – Francesco Callari Mar 04 '13 at 14:11