Next: Deconvolution and image reconstruction
Up: Process menu
Previous: Trace curve
Contents
Index
Fourier Transform
Performs a Fast Fourier Transform on the image or selected
region. This can use a lot of memory because the frequencies are
stored as double-precision complex numbers, which require 16
bytes for each pixel. Thus, an FFT is 4 times as expensive as
a 32-bit image. Additionally, the mathematics of the FFT requires
that the image be first enlarged so that each dimension is the next
higher power of two. For example, if your image is 129 x 67 pixels,
tnimage has to create a new buffer of 256 x 128 pixels (524,288
bytes) to carry out the calculations. Your image is automatically
enlarged to that size. Moreover, the sharp discontinuity
between the edge of the image and the new black pixels in the buffer
can create undesirable artifacts in the Fourier transform.
The FFT result is a matrix which is displayed as a new 128 bit/pixel
image. This new image can be saved, unloaded, annotated, filtered,
and manipulated like any other image. Any changes made
to this image (such as adding text) are also converted to the
appropriate floating point numbers and inserted at the appropriate
position into the displayed component (real or imaginary) of the
FFT matrix. Therefore, changing pixels by typing on the displayed image
could change the real component of the FFT, the imaginary component, or
both. After editing the image to enhance or eliminate specific
spatial frequencies, perform a reverse FFT to obtain
the filtered result.
Forward/Reverse/Change display only
Selects whether to carry out a forward or reverse FFT, or to
merely change which component (original image, imaginary, real,
or power spectrum) is being displayed. No actual change is made
to the FFT data. The display can also be changed by typing fftdisplay mode in the command editor, where mode is 0=original,
1=real, 2=imaginary, and 3=power spectrum.
Real/Imaginary/Power spectrum
Selects whether to display the real, imaginary, or power spectrum
component of the transformed image, or only the original image.
NOTE:
If you select ``imaginary'' or ``power spectrum'', the displayed
image will appear black if you perform a FFT followed by a reverse
FFT. This is because the original data do not have an imaginary
component. The original data are not lost!
Although a complete description of the many applications of
FFTs and deconvolution is beyond the scope of the manual, there
are a few tnimage- specific points worth remembering:
- Regardless of the screen mode or color depth of the
image, the FFT and deconvolution algorithms treat all pixels
as monochrome. Thus, a 24-bit/pixel image is treated as a 24
bit deep grayscale image. In other words, the colors are not
deconvoluted separately in the current version of tnimage.
- The grayscale mapping algorithm sets the most negative
FFT result to black and the most positive FFT result to white.
Thus, zero will be some shade of gray.
- Editing power spectra will lead to unpredictable results
in your image.
- Select ``About...About the image'' to view some of the FFT
parameters. These include:
- Minimum FFT value (which is mapped to black)
- Maximum FFT value (which is mapped to white)
- FFT=0 color value (the color to which FFT values of zero are mapped)
- FFT=0 RGB values (the corresponding red, green, and blue components
of the FFT=0 color value).
These numbers can be used to calculate the color values needed
to edit the image in the frequency domain to remove or accentuate
specific frequencies. The filtered image can then be reverse-
transformed to obtain the result.
- When an image is set to display the real or imaginary frequency components
of an image, operations that only affect the original image (such as
``flip image'', ``change contrast'', etc. will appear to have no effect.
Before performing these operations, select ``Process..FFT...Change display
only'' to switch the display to the original image.
- FFTs are displayed in the conventional manner, i.e. with
lowest positive frequencies at the top and left, lowest
negative frequencies on the right and bottom, and Nyquist in
the center, with the exception that only the real or imaginary
components are shown, as illustrated in the diagram below:
In this diagram, the shaded area marks portions of the FFT extending beyond
the lower right corner of the original image. The 0,0 frequency is in the
upper left corner, and the f=0 frequencies run vertically
along the left and top edge, from f=0, f=1/N, ... f=n, f=-n, ... f= -1/N.
If the x or y size of the image is not a power of 2, the image is enlarged to the
next power of 2 in each dimension.
- FFTs should be done with as few other images present as possible.
Because an FFT is extremely memory-intensive, if tnimage is forced
to use virtual memory, the FFT may take a very, very long time.
- When deconvoluting or convoluting, the two images should be
approximately the same size for optimal results.
- Avoid image sizes that are just larger than a power of 2, such
as 129 x 129 pixels. This will cause the complex array for FFT to
be allocated as the next higher power of 2 (i.e., 256 x 256).
The additional pixels will also be set to solid black, which will
create artifacts in the FFT.
- The screen mappings of FFT intensity values are automatically
rescaled whenever the FFT image is redrawn. Thus, changing the
contrast of an FFT'd image will have no effect on the appearance of
the real or imaginary components.
To change the brightness of a FFT'd image, use ``Color...Grayscale map''.
Example: Removing periodic noise from an image.
Periodic noise, such as the circular dots and moiré patterns that
appear when a newspaper photo is scanned in a scanner, are ideal
candidates for removal by Fourier transform.
- Make sure the image is close to a power of two in both x and y
dimensions.
- Select ``Process..FFT'' and click ``Operation = Forward'' and
``Display = Real FFT''. (The ``Data'' and ``Display scale factors''
are used only for deconvolution and can be ignored).
- Click OK. The FFT'd image should show white dots or lines near
the middle of the image. These represent the spatial frequencies of
the periodic noise.
- Select the areas to be erased with the mouse and press Del,
or erase them by setting the Fcolor to 0 and drawing over them.
Do not erase along the edges or in the upper left corner.
- Select ``Process..FFT'' and click "Display = Imaginary FFT'',
and repeat the erasing process on the imaginary components.
- Select ``Process..FFT'' and click ``Operation = Reverse''.
The new image should have most of the noise removed.
- Repeat if necessary.
Convolution
View the image DECONVOL.TIF for a quick tutorial on convolution and deconvolution.
Convolution - Convolutes two images. Convolution is the same as multiplication
in the frequency domain. Therefore, the resultant image will have
the characteristics of both images. In the simplest possible example,
a sharp image convolved with an image of a blurred point will become
blurry. An image convolved with a single point is unchanged.
Subsections
Next: Deconvolution and image reconstruction
Up: Process menu
Previous: Trace curve
Contents
Index
root
2006-11-13