Any image can be reconstructed from a series of sinusoidal gratings.
A sinusoidal grating looks like this…
/2
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
/3
There's one more parameter that defines a sinusoidal grating: the phase. Gratings with a different phase are shifted with respect to each other…
/7
You can create a 2D sinusoidal grating in #Python using #NumPy and display it using #matplotlib
/8
@s_gruppetta Ah, I see farther downthread that the book has the code!
@peterdrake and yes, the article linked later has the full code etc…
@peterdrake I have been doing this (on Twitter) for a few months now, but this is an old post (from Twitter, recycled here) so the images didn’t have them. I now autogenerate these snippets which makes adding the code in ALT text easy