2D Fast Fourier Transform (FFT) Java Applet

This page is a tutorial for the 2D Fast Fourier Transform Applet: (I suggest openning it in a new window by right-clicking or control-clicking so you can read this tutorial.)

http://www.brainflux.org/java/classes/FFT2DApplet.html

 Basic Information

 Both the data and the Fourier transform can be complex. The magnitude is represented by brightness and color by phase as shown in the complex plane to the left and in the applet's color picker. Pure positive real is bluish-cyan and negative imaginary is red. The display setting tools under the images (shown highlited to the left) don't modify the data, just how it is displayed. If you wanted to display only the real part of the image, click on the appropriate button under it. Because Fourier transforms often have data spanning by many orders of magnitude, the Brightness slider lets you smoothly change the brightness over orders of magnitude in a "tangent function" way.

 Fourier Transform of Gaussian is Gaussian

 When the Applet first comes up, it displays a 2D Gaussian in the data panel and it's Fourier transform in the other. You can get back to this by pressing the Gaussuan button on the bottom. Draw your own Gaussian by clicking on the clear button in the bottom left, then the Gaussian paintbrush tool. Be sure to chose a non-zero complex number to draw with in the picker (it's the rainbow-colored complex plane in the center below the hand). You can set the size of the Gaussian with the slider. By trying different sizes, you can see that the Fourier transform of a small feature is big (try drawing a single point.)

 Shift -> multiplication by phase.

 Using the hand tool, you can grab and shift either the data or its Fourier transform. Either way, the other gets multiplied by a phase shift. By displaying only the magnitude, you can verify that it's only the phase at each point that gets modified. The phase shift is position dependent and is how "location" information is encoded -- how far over to shift each of the sine waves that's making up the image. Careful observers will notice when they shift the data in the positive direction (to the right), the Fourier Transform gets multiplied by a phase the increases in the positive direction. Shifting the Fourier Transform to the left has the opposite effect on the data. This is because the Inverse Fourier Transform has the opposite sign in the exponent.

 Fourier Transform of box is sinc

 Using either the button on the bottom, or drawing your own square with the square tool, you can see the Fourier Transform of a square has sinc lobes going off to the top and sides. By using the brightness slider to make things brighter, you can see the dim pattern off axes. By making everything dimmer, you can get a sense of how much brighter the main center dot is than the rest. Shown to the right is a 1D Fourier Transform of a square (computed by the Srhrodinger1D Applet) which is the same as the intensity of the 2D transform along either axis.

 Blur an Image

 Clicking on the image button on the bottom or by typing in the URL of an image on the web -- it will automatically be converted to a pure-positive-real image at the resolution selected (default is 128x128.) By using the square tool and using the selector to draw zero you can remove the high spatial frequency components and see the image get blurry. (If you're within a few pixels of the origin, the program will use exactly zero.)

 Pure Real -> Symmetric and Imaginary -> Anti-Symmetric

 Pull up an image and click on the "Discard Imaginary Part" or "Discard Real Part" buttons which will keep the other part unaltered. Unlike the display buttons, these actually change the underlying data. It's easier for display purposes to discard the Fourier transform's information and make the image symmetric. In the example to the left, I've discarded the real part making the Fourier transform pure imaginary (yellow and purple) and the image has become anti-symmetric in both -- comparing top right to bottom left, pixel values get negative.

 Phase vs Magnitude

 Which is more important in the Fourier transform, magnitude of phase? When we think of Fourier analysis on sound, for example, we're almost exclusively interested in the magnitude information, but it's the phase of each component that determines how much that sin wave will be shifted over. To investigate, pull up an image and click on the "Discard Phase" or "Discard Magnitude" buttons. Unlike the display buttons, these actually change the underlying data.At the left I have discarded magnitude information and kept only phase. It still looks recognizable. When phase information is discarded, it's a blurry jumble. Unfortunately in x-ray crystallography, only the magnitude information is measurable.