- Because the discrete Fourier transform is discrete in space, it's periodic in frequency
Let's think of the Fourier Transform of a continuous, periodic function: FT explains the function as a projection of the signal onto a sum of sinusoidal basis functions, i.e. correlates the signal with a bunch of complex sinusoids, each with its own frequency. Thus, any data point contributes to a sinusoid with a particular frequency - data is encoded into the frequency. Thus FT becomes discrete. Now inverse also holds: If the space is discrete, one would require a periodic FT to represent that (non periodic signal on one domain causes continuous signal on the other).
I really like this animation showing the continuous FT.
Mathematically, it is always possible to show that for DFT, $X_K = X_{K+N}$ where $N$ is the period such as in here.
- And because the spatial data is real, the frequency data is symmetric. The middle of the square correspond to the Nyquist frequency (half the sampling frequency).
First let's address the symmetry:
I will greatly cite this stackexchange post and for completeness will include some shortened portion here:
Due to its definition, FT will generate symmetric responses for real data. Take the transform equation:
$H(f) = \int h(t)e^{-j2\pi ft}dt$.
Using Euler's formula $e^{jx} = \cos(x) + j*\sin(x)$, we could modify the Fourier transform as follows:
$$
H(f) = \int h(t)(\cos(2\pi ft) - j\sin(2\pi ft))dt
$$
FT for negative frequencies become:
$$
H(-f) = \int h(t)(\cos(2\pi (-f)t) - j\sin(2\pi (-f)t))dt \\
= \int h(t)(\cos(2\pi ft) + j\sin(2\pi ft))dt
$$
Comparing the negative frequency version with the positive frequency version shows that the cosine is the same while the sine has phase inversion of $90^\circ$. Magnitude is the same. Due to this orthogonality, they will both respond to real signals in the same way.
Now for the Nyquist part:
The Nyquist frequency represents the highest frequency that can be represented by the sampling rate (differs from Nyquist rate). The DFT of a real series, i.e. zero imaginary part, results in a symmetric series about the Nyquist frequency - this is where the signal folds. In the image you have given, the mid-part is exactly about where the symmetry is created. This is also where the DC component lies.
I hope these bring in some clarification.
fftshift
on the transformed filter before displaying. i.e. replace your third line withkSobelXfft = fftshift(fft2(kSobelX))
. This way, when you display the fourier transform, the image looks like what you would expect, with the zero frequency in the middle. $\endgroup$