Constructing frequency filter from a 2d spatial filter Given a 2d spatial kernel $h$, I want to construct the corresponding frequency filter $H$. In theory, $H$ is simply obtained by calculating DFT of $h$ using a FFT algorithm. But in practice, there are some considerations to be considered. First, if $H$ is used for filtering, zero-padding is required. Second, after zero padding, the original center of $h$ (i.e. center of $h$ before zero padding) must circularly-shift to the upper-left corner.
I know that zero padding is used to overcome wraparound errors. And I have observed, by experiment, shifting the original center to the upper-left corner prevents shifting the filtered image. But my question is why this is the case? That is, why not shifting the original center, leads to shifting the final image; and how shifting the original center resolves the problem?
Thanks
I found it! Placing the original center at the upper-left corner, by circularly-shifting $h$, makes $h$ an even function. From the properties of Fourier Transform, we know the DFT of a real and even function is real. So, $H$ becomes real and its phase angle is zero. Hence, the phase of the filtered image is as the phase of the original image.
By the way, shifting $h$ does not affect the frequency spectrum of $H$.