What's an image made of?
There are many correct answers.
But the most fascinating one is: << sines & cosines >>
Read on if you're intrigued👇🧵🪡
#python#images#fourier
*Any* image can be reconstructed from a series of sinusoidal gratings.
A sinusoidal grating looks like this…
#sinusoidal#grating
It’s called a sinusoidal grating because the grayscale values vary according to the sine function.
If you plot the values along a horizontal line of the grating, you’ll get a plot of a sine function
Sinusoidal gratings can have different orientations…
…different amplitudes…
…and different frequencies—these are spatial frequencies, not temporal ones
There's one more parameter that defines a sinusoidal grating: the phase. Gratings with a different phase are shifted with respect to each other…
Or even better, you can use a function of both x and y to make any grating
You can find the parameters of a sinusoidal grating by using the 2D #FourierTransform.
The dots shown contain the amplitude and phase of the grating. Their position from the centre gives the frequency, and their orientation represents the orientation of the grating.#
Now, if you have lots of gratings superimposed on each other, the #FourierTransform gives you a pair of dots for each of the components
Now, here's the "magical" part of #Fourier theory.
*Any* image is made up of lots of sinusoidal gratings. So, the 2D Fourier Transform of an image gives you thousands of pairs of dots, and each pair represent a sinusoidal grating.
And therefore, you can reconstruct the image by adding all of those sinusoidal gratings together.
The more gratings you add, the closer the result is to the actual image
Here's another example
and another one
[these are traditional #MalteseBalconies, which is where I'm originally from—#Malta, that is, not the balconies!]