But the most fascinating one is: << sines & cosines >>

/1

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

Sinusoidal gratings can have different orientationsâ€¦

/4

â€¦different amplitudesâ€¦

â€¦and different frequenciesâ€”these are spatial frequencies, not temporal ones

/6

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 using and display it using

/8

@s_gruppetta Would it be feasible to include the code in the toot or as alt text? I'd love to try pasting it into Python, but of course I can't do that from an image.

@s_gruppetta Ah, I see farther downthread that the book has the code!

Â· Â· Â· Â·

@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

@peterdrake and yes, the article linked later has the full code etcâ€¦

QOTO: Question Others to Teach Ourselves