Lemme FFT that for ya

Here’s my self portrait:

final

This actually contains the same information as the following image:

final

The difference between them is that the first one is the 2D fourier transform of the second! I found this rather cool Java library that performs the fast fourier transform like a frickin’ champ. I’ve never messed around with Java before, so figuring out how to load the library was kind of a pain, but I ended up figuring it out. I’d like to be able to put the .jar file in the libraries folder in my sketchbook directory (which I know is possible) but I couldn’t figure that out. I made a video that shows the functionality of my processing code, and you can find it here. Basically, by moving the cursor up the screen, you cut out increasingly more frequencies from the fourier transformed image. The resulting inverse fourier transformed image becomes increasingly mangled as you move the cursor up the window. What’s cool about this is that even after cutting out more than 75% of the values in the frequency-domain array, the image (in space-domain) remains pretty good looking. My understanding is that a lot of lossy image/sound compression formats (including JPEG and MP3) use this algorithm (or similar ones, namely the wavelet transform and its inverse).

 

Leave a Reply