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
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).