MATLAB: Equivalent of zero padding in frequency space

fourierzero padding

I was wondering if instead of zero padding an image in space domain and then taking its FT, I could take the FT first and the do something to simulate the 0 padding? This is for template matching function that I'm writing. I need zero padding because I perform convolution by taking FT of both the template and data image and then find the product of the transforms, so the 2 transforms need to match in size. I don't use conv2 function because I perform template matching with approximately 100 different scales of the template image and conv2 takes too long. I would really appreciate any suggestions. Thank you very much!

Best Answer

Since zero-padding in the space domain increases the frequency resolution in the frequency domain, the equivalent in the frequency domain seems to me to create a frequency vector of the appropriate increased length (using linspace with the same frequency limits as the original frequency-domain result to create the appropriate vectors in each dimension) and then interpolate to it, creating a frequency-comain result with increased frequency resolution. That is how I would do it with a one-dimensional signal (such as in signal processing), so a similar approach should work with a two-dimensional signal. Note that you would have to do this on the complex result if you wanted to invert it later.
I have never actually done this on a two-dimensional signal, so experiment with it to see how well it works.