IDL Tutorial: Advanced Image Processing
IDL Tutorial: Advanced Image Processing
IDL® is a registered trademark of ITT Visual Information Solutions for the computer
software described herein and its associated documentation. All other product names
and/or logos are trademarks of their respective owners.
The IDL Intelligent Tools (iTools)
The IDL Intelligent Tools (iTools) are a set of interactive utilities that combine data
analysis and visualization with the ability to produce presentation quality graphics.
The iTools allow users to continue to benefit from the control of a programming
language, while enjoying the convenience of a point-and-click environment. There
are 7 primary iTool utilities built into the IDL software package. Each of these seven
tools is designed around a specific data or visualization type :
• Two and three dimensional plots (line, scatter, polar, and histogram style)
• Surface representations
• Contours
• Image displays
• Mapping
• Two dimensional vector flow fields
• Volume visualizations
In the following exercise, the image from the example data file “meteorite.bmp” will
be input into IDL. This example data file is located in the “data” subfolder.
The file is in Windows bitmap format and contains an image of a thin section taken
through the Shergotty meteorite that is believed to represent a sample of the surface
of Mars. Input the image data into the current IDL session by utilizing the Import
Image macro built into the IDL Development Environment :
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 2 of 34
1. IDL> import_image
2. Navigate to the “data” subfolder and select the “meteorite.bmp” file.
Information on the image and a small preview will be displayed in the bottom
of the Select Image File dialog [Fig. 1].
3. Press the “Open” button to read the image data into IDL and dismiss the
Import Image wizard.
Once the Import Image macro is finished running the user will be returned to the
main IDLDE window where a new variable named “meteorite_image” is now present
within the current IDL session. The HELP procedure can be used to obtain
information on this variable :
The output from the HELP procedure shows that the “meteorite_image” variable is
actually a structure containing multiple pieces of data and information read in from
the BMP image file. To obtain information on the contents of this structure variable
the HELP procedure must be executed with the STRUCTURE keyword set :
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 3 of 34
IMAGE BYTE Array[514, 343]
R BYTE Array[256]
G BYTE Array[256]
B BYTE Array[256]
QUERY STRUCT -> <Anonymous> Array[1]
The actual image data from the BMP file is stored in the IMAGE tag of the structure
variable, which contains a 2-dimensional array that has 514 columns and 343 rows
with an 8-bit (BYTE) data type. The R, G, and B tags within the structure variable
are provided to store the color table vectors that can be stored within 8-bit BMP files,
which in this case are not necessary since the image is in simple grayscale mode.
Furthermore, the QUERY tag stores yet another sub-structure that contains other
useful information on the BMP image file.
In order to access the data that is stored within the fields of this “meteorite_image”
structure, the period “.” character must be used to reference the tags. For example,
to view the information within the QUERY sub-structure field the following syntax
must be utilized :
The QUERY field contains some useful information on the BMP image file. In order to
access the actual image data stored within the “meteorite_image” structure in a
manner that does not require a lot of typing, extract the IMAGE field of the structure
and assign it to a new variable named “image” :
Once this is accomplished a new variable is created at the main IDL level that is
simply called “image” :
Now that the image data has been extracted into a simple variable it can be easily
visualized by loading it into the iImage utility :
The resulting IDL iImage visualization window should look similar to Fig. 2.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 4 of 34
Figure 2: Display of the Shergotty meteorite image within the iImage utility
On the right-hand side of the IDL iImage window the “Min:” and “Max:” boxes show
that the pixels in the image range throughout the full 8-bit range (0 255).
However, the histogram plot window illustrates that most of the pixels within the
image have brightness values in the lower half of the data range. The histogram plot
is essentially portraying the overall dark gray to black appearance of the image.
10. Within the “Max:” field box, type a pixel data value of 110 and press the Enter
key on the keyboard. This will saturate all pixels in the image with a value of
110 or higher to white, while stretching the pixels with values 0 109
throughout the full range of the grayscale display.
The resulting IDL iImage visualization window should look similar to Fig. 3.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 5 of 34
Figure 3: Contrast enhancement of the image via a linear stretch
This manipulation of the histogram stretch bars only affects the display of the image
and does not change the actual pixel values for the image dataset. Notice that the
“Pixel Value:” field within the Image panel now displays a number in parentheses
next to the actual pixel data value. This number in parentheses is the output
grayscale intensity for the current pixel according to the stretch that is being applied.
11. Change the “Max:” field back to “255” by either typing in the text box or
clicking on the green stretch bar and dragging it back up to the top of the
histogram display window.
There are a number of analysis tools found within the Operations menu of the iImage
utility. The operations that are built into the iTools system represent some of the
most common image processing tasks.
12. While the image object is selected within the IDL iImage window, select
“Operations > Statistics…” from the menu system.
A separate dialog will appear that displays some statistical information on the current
image dataset [Fig. 4]. Notice that the average (mean) pixel value for this image is
47.7387, which explains the relatively dark appearance of the original image.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 6 of 34
13. Once finished viewing the image statistics, close the Display statistics for the
selected item dialog.
One of the operations built into the iImage utility is the Unsharp Masking
technique, which applies a sharpening filter to the image. Digital Unsharp Masking
is a digital image processing technique that increases the contrast where subtle
details are set against a diffuse background. This operation suppresses features
which are smooth (those with structures on large scales) in favor of sharp features
(those with structure on small scale), resulting in a net enhancement of the contrast
of fine structure in the image.
14. From the IDL iImage window menu system select “Operations > Filter >
Unsharp Mask”.
15. Within the Unsharp Mask dialog that pops up, leave all parameters set to their
default values and simply press “OK”.
Notice that the fine detail within the image is enhanced by applying the Unsharp
Mask operation.
The iImage utility also has a built-in tool for convolving an image array with a kernel.
Convolution is a simple matrix algebra operation that can be used for various types
of smoothing, shifting, differentiation, edge detection, etc..
16. Select “Operations > Filter > Convolution” from the iImage menu system. A
separate dialog entitled Convolution Kernel Editor will appear [Fig. 5].
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 7 of 34
Figure 5: The iTools Convolution Kernel Editor dialog
The Convolution Kernel Editor window allows the user to select from a list of pre-
defined kernels, or define their own user-defined kernel. The convolution of these
different kernels will have a wide variety of effects on the resulting image display.
The Laplacian filter can be applied by convolving a Laplacian kernel with the image.
A Laplacian filter is an edge enhancement filter that operates without regard to edge
direction. Laplacian filtering emphasizes maximum values within the image by using
a kernel with a high central value typically surrounded by negative weights in the up
down and left-right directions and zero values at the kernel corners. The Laplacian
kernel convolution is a form of high pass filter, which removes the low frequency
components of an image while retaining the high frequency (local variations). It can
be used to enhance edges between different regions as well as to sharpen an
image.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 8 of 34
17. Using the droplist next to the “Filter” parameter in the upper left hand corner
of the Convolution Kernel Editor dialog, select the “Laplacian” kernel.
18. Notice that a surface representation of the current kernel is displayed within
this dialog. The user can click on this surface and rotate it in order to
visualize the structure of the kernel.
19. Once the “Laplacian” kernel has been selected press “OK” to apply the
convolution operation and dismiss the Convolution Kernel Editor dialog.
20. At this point, it is beneficial to change the range for the current stretch to the
following values :
• Max: 140
• Min: 115
The application of the Laplacian filter will enhance the edges between different
regions (in this case mineral grains) within the image. The resulting IDL iImage
visualization window should look similar to Fig. 6.
IDL also has a number of morphological image operators built into its library of
routines. Mathematical morphology is a method of processing digital images on the
basis of shape. Some of these morphological algorithms have been added to the
operations within the iTools system. For example, the dilate operator, which is
commonly known as the "fill", "expand", or "grow” operator, can be used to further
enhance the boundaries between mineral grains in the current image.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 9 of 34
21. Select “Operations > Morph > Dilate” from the iImage menu system. A
separate dialog entitled Dilate will appear [Fig. 7]. The parameters
associated with the dilate operation are displayed in this dialog along with a
preview of the operation.
22. Click on the box to the right of the “Structure shape” field and change the
setting to “Circle” [Fig. 7].
23. Press the “OK” button to apply the dilate operation and dismiss the Dilate
dialog.
The resulting IDL iImage visualization window should look similar to Fig. 8.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 10 of 34
Figure 8: Application of the Dilate morphological operation
24. Once finished viewing the processed image, close the IDL iImage window.
In addition to sharpening, high pass filtering, and edge enhancement techniques, IDL
also offers operations to perform image smoothing, low pass filtering, and noise
removal. Re-launch the iImage utility with the original image so these techniques
can be investigated :
The median operation replaces each pixel with the median of the two-dimensional
neighborhood of the specified width. In an ordered set of values, the median is a
value with an equal number of values above and below it. Median filtering is
effective in removing salt and pepper noise (isolated high or low values). The
resulting image will have a less grainy appearance than the original.
26. From the iImage menu system, select “Operations > Filter > Median”.
27. Within the Median dialog window, leave all of the default settings and press
“OK”.
The smooth operation will compute the boxcar average of a specified width for the
image. Smoothing is similar to the median filter except the pixels are replaced with
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 11 of 34
the average (mean) value across the neighborhood. This tends to have the effect of
blurring the edges within the image and making them more diffuse.
28. From the iImage menu system, select “Operations > Filter > Smooth”.
29. Press the “OK” button to apply the smoothing operation and dismiss the
Smooth dialog window.
Finally, the Convolution tool can be used once again to apply a low pass filter to the
image. The Gaussian kernel provides a form of low pass filtering that preserves the
low frequency components of an image.
30. Select “Operations > Filter > Convolution” from the iImage menu system.
31. Within the Convolution Kernel Editor dialog, change the “Filter” selection
droplist to “Gaussian” [Fig. 9].
32. Edit the number of columns and rows fields so the kernel has a size of 5 x 5
[Fig. 9].
33. Press the “OK” button to apply the Gaussian filter and dismiss the dialog.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 12 of 34
Figure 9: Application of the Gaussian filter convolution
The resulting IDL iImage visualization window should look similar to Fig. 10.
Figure 10: Image display after noise removal, smoothing, and low pass
filtering
34. Once finished viewing the processed image, close the IDL iImage window.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 13 of 34
level) determines how the masking occurs. In IDL, thresholding is performed using
the relational operators. IDL’s relational operators are illustrated in Table 7-1 :
OPERATOR DESCRIPTION
EQ Equal to
NE Not equal to
GE Greater than or equal to
GT Greater than
LE Less than or equal to
LT Less than
For example, in order to threshold the Shergotty meteorite image and identify the
pixels that have a value greater than 70 (byte) simply execute the following
statement :
This expression creates a new variable named “mask” that is a 2-dimensional array
of the same size as the original image. This new “mask” variable contains a binary
image where each pixel has a value of either one (original image pixel value was
greater than 70) or zero (original image pixel value was equal to or less than 70). At
this point, the user may wish to view this binary threshold image by loading it into
the iImage utility :
The resulting image display within the IDL iImage window should appear completely
black. This is due to the fact that all of the pixels within the “mask” binary image
have a value of 0 or 1, which are very difficult to discern (and very dark) within a 0
255 grayscale display. Consequently, the BYTSCL function should be utilized
when displaying binary images so the pixels with a value of 1 are actually mapped to
255 (white). The BYTSCL function scales all values of an array into a specified range
(0 255 by default) :
The resulting IDL iImage visualization window should look similar to Fig. 11.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 14 of 34
Figure 11: Threshold image showing pixels with values greater than 70
(white) and less than or equal to 70 (black)
5. Once finished viewing the binary threshold image, close the IDL iImage
window.
Binary threshold images can also be used to mask-out the pixels in an image that
do not qualify based on the given expression. For example, in order to display only
those pixels from the original image that have a value greater than 70 simply
execute the following statements :
The resulting IDL iImage visualization window should look similar to Fig. 12.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 15 of 34
Figure 12: Display of the original image with all pixels that have a value of
70 or less masked-out (i.e. displayed as black)
8. Once finished viewing the masked image, close the IDL iImage window.
The user can also provide both upper and lower bounds when creating threshold
images by using the Boolean operators built into IDL (AND, NOT, OR, and XOR). For
example, create a threshold image that identifies those pixels which have a data
value between 50 and 70 :
The resulting IDL iImage visualization window should look similar to Fig. 13.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 16 of 34
Figure 13: Threshold image showing all pixels with data values between 50
and 70
11. Once finished viewing the threshold image, close the IDL iImage window.
Clipping is similar to thresholding because pixels with data values above or below a
specified level are all set to the same value. However, when clipping an image the
pixels that do not satisfy the expression are set to the selected level and the
resulting image is not binary in nature. Clipping can be used to enhance features
within an image.
In IDL, clipping is performed with the minimum (<) and maximum (>) operators. In
order to clip an image the user must design an expression that contains an image
array, the appropriate operator, and the clipping level. For example, to clip the
meteorite thin section image so that all pixels with a value greater than or equal to
50 are set to a value of 50 simply execute the following statements :
The resulting IDL iImage visualization window should look similar to Fig. 14.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 17 of 34
Figure 14: Clipped image showing all pixels with data values 50 or higher
set to a brightness level of 50
14. Once finished viewing the clipped image, close the IDL iImage window.
The resulting IDL iImage visualization window(s) should look similar to Fig. 15.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 18 of 34
Figure 15: Stretched image that highlights all pixels with data values
between 25 and 100
19. Once finished viewing the stretched image, close the IDL iImage window(s).
In addition to simple linear stretching techniques, IDL also has routines that allow
the user to stretch the image using other histogram manipulations. For example, the
HIST_EQUAL function can be used to apply a histogram equalization stretch to the
image data. Histogram equalization employs a monotonic, non-linear mapping which
re-assigns the intensity values of pixels in the input image such that the output
image contains a uniform distribution of intensities (i.e. a flat histogram). Execute
the following statements in order to derive and display the histogram-equalized
version of the meteorite thin section image :
Notice that the resulting image has improved contrast and the histogram has a very
even distribution throughout the 0 255 range. The resulting IDL iImage
visualization window should look similar to Fig. 16.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 19 of 34
Figure 16: Image display with a histogram equalization stretch
22. Once finished viewing the histogram-equalized image, close the IDL iImage
window.
The resulting IDL iImage visualization window should look similar to Fig. 17.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 20 of 34
Figure 17: Image display with an adaptive histogram equalization stretch
25. Once finished viewing the adaptive histogram-equalized image, close the IDL
iImage window.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 21 of 34
element determines what is extracted or deleted from an image. In general, smaller
structuring elements preserve finer details within an image than larger elements.
Start by thresholding the Shergotty meteorite image in order to identify the dark
mineral grains with a pixel value less than or equal to 20 :
Next, create a structuring element array with a square shape that will help extract
objects with sharp rectangular edges :
The MORPH_CLOSE function can be used with this structuring element to apply the
closing operator to the binary threshold image. The closing operator has the effect
of clumping the threshold image, thereby filling in holes within and connecting gaps
between neighboring regions. In addition, the MORPH_OPEN function can be
subsequently used to apply the opening operator, which will have a sieving effect on
the image that helps to remove small isolated regions. Apply these morphological
operations and visualize the results in comparison to the original image :
The resulting IDL iImage visualization window should look similar to Fig. 18.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 22 of 34
Figure 18: Display of original image (upper left), binary threshold image of
dark mineral grains (upper right), application of a clumping operation
(lower left), followed by a sieving operation (lower right)
The resulting IDL iImage visualization window should look similar to Fig. 19.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 23 of 34
Figure 19: Image segmentation of the separate dark mineral grains
26. Once finished viewing the segmentation image, close the IDL iImage window.
In the frequency or Fourier domain, the value and location are represented by
sinusoidal relationships that depend upon the frequency of a pixel occurring within
an image. In this domain, pixel location is represented by its X and Y frequencies
and its value is represented by an amplitude. Images can be transformed into the
frequency domain to determine which pixels contain the most important information
and whether repeating patterns occur.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 24 of 34
In addition to the Fourier domain, IDL also has the ability to transform images into
the wavelet (time-frequency), Hough, and Radon domains. In the wavelet domain
the value and location of pixels are represented by sinusoidal relationships that only
partially transform the image into the frequency domain. The wavelet
transformation process is the basis for many image compression algorithms. The
image information within the Hough domain shows the pixels of the original
(spatial) image as sinusoidal curves. If the points of the original image form a
straight line, their related sinusoidal curves in the Hough domain will intersect.
Masks can be easily applied to the image within the Hough domain to determine if
and where straight lines occur. The image information within the Radon domain
shows a line through the original image as a point. Specific features and geometries
within the original image will produce peaks within the Radon domain and can be
easily identified.
In IDL, the FFT routine can be utilized to perform a Fast Fourier Transformation
and convert an image from the spatial domain into the frequency domain. In the
following exercise, the image data from the example data file “hamburg.jp2” will be
input into the iImage utility and subsequently transformed into the Fourier domain.
This example data file is located in the “data” subfolder.
The file “hamburg.jp2” is in JPEG2000 format and contains a satellite image of the
loading docks at the port in Hamburg, Germany. Start by loading this image into a
new iImage utility :
1. IDL> iImage
2. From the iImage menu system select “File > Open…”.
3. Select the “hamburg.jp2” file and hit “Open”.
The resulting image display should look similar to Fig. 20. Notice the linear and
rectangular patterns that are prevalent in this image in both diagonal directions.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 25 of 34
Figure 20: Image of the port in Hamburg, Germany
Once the image has been loaded into the iImage utility, it can be exported to an IDL
variable for processing at the IDL> command prompt. Use the following steps to
create a variable for this image at the main IDL level :
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 26 of 34
Figure 21: Step 2 of 3 of the IDL Data Export Wizard
A new variable named “hamburg” now exists at the main IDL level :
In order to work with this image in the frequency domain it is beneficial to extract
the individual color channel images. This can be accomplished using IDL’s standard
array subscripting syntax in conjunction with the REFORM function, which is used to
remove the first dimension (that has a size of one) and return a simple two-
dimensional array :
Note: Remember that the up-arrow and down-arrow keys on the keyboard can be used to perform
command recall within IDL, which may be beneficial during these exercises.
Once this is accomplished, the FFT routine can be used to transform the image
planes into the frequency domain :
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 27 of 34
14. IDL> rFFT = FFT (r)
15. IDL> gFFT = FFT (g)
16. IDL> bFFT = FFT (b)
The Fast Fourier Transform decomposes an image into sines and cosines of varying
amplitudes and phases. The values of the resulting transform represent the
amplitudes of particular horizontal and vertical frequencies. The data type of the
array returned by the FFT function is complex, which contains real and imaginary
parts :
The amplitude is the absolute value of the FFT, while the phase is the angle of the
complex number, computed using the arctangent. In most cases, the imaginary part
will look the same as the real part.
The image information in the frequency domain shows how often patterns are
repeated within an image. Within the Fourier domain, low frequencies represent
gradual variations in an image, while high frequencies correspond to abrupt
variations in the image. The lowest frequencies usually contain most of the
information, which is shown by the large peak in the center of the result. If the
image does not contain any background noise, the rest of the data frequencies are
very close to zero.
The results of the FFT function are often shifted to move the origin of the X and Y
frequencies to the center of the display. Furthermore, the range of values from the
peak to the high frequency noise is usually extreme. Consequently, a logarithmic
scale is often utilized in order to visualize the image in the frequency domain. Since
the logarithmic scale only applies to positive values, the power spectrum should be
computed since it is the absolute value squared of the Fourier transform.
Visualize the power spectrum of the Fourier domain image for the green channel by
executing the following statements :
The resulting IDL iImage visualization window should look similar to Fig. 22.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 28 of 34
Figure 22: Power spectrum for the green channel image in the frequency
domain
Notice the orientation of spatial patterns within the power spectrum image in both of
the diagonal directions (just like the original image).
23. Once finished viewing the power spectrum image, close the IDL iImage
window.
It may also be beneficial to visualize the power spectrum as a surface. Use the
REBIN function to sub-sample the power spectrum in order to suppress some of the
noise and set the shading for the surface to Gouraud :
The resulting IDL iSurface visualization window should look similar to Fig. 23.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 29 of 34
Figure 23: Power spectrum displayed as a surface
25. Once finished viewing the power spectrum surface, close the IDL iSurface
window.
Low frequencies within the image tend to contain the most information because they
determine the overall shape or patter in the image. High frequencies provide detail
in the image, but they are often contaminated by the spurious effects of noise.
Consequently, masks can be easily applied to an image within the frequency domain
in order to remove noise.
Create a mask for the low spatial frequency components based on the highest values
within the power spectrum for the green channel image :
Note: The threshold value of –2.5 was arbitrarily selected based on the surface visualization above.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 30 of 34
The resulting IDL iImage visualization window should look similar to Fig. 24.
Figure 24: Mask of the low spatial frequency components (white) within the
power spectrum for the green color channel
Notice that the low frequency components are found predominantly in the center of
the power spectrum.
28. Once finished viewing the mask image, close the IDL iImage window.
In order to remove the high spatial frequency noise from the image, this mask must
be applied to the Fourier transform data and then the inverse FFT must be
computed. Applying the low spatial frequency mask allows these components to be
converted back to the spatial domain during the inverse transform, while the high
spatial frequency components are masked out.
First, the mask image must be shifted back to the original location of the Fourier
transform :
Once this is accomplished, the mask can be applied to the FFT results for the 3 color
channels :
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 31 of 34
30. IDL> rMasked = rFFT * lsfMask
31. IDL> gMasked = gFFT * lsfMask
32. IDL> bMasked = bFFT * lsfMask
The inverse FFT can be used in conjunction with the REAL_PART function in order to
convert the images back into the spatial domain :
The result can be visualized by loading the individual color channel images into the
iImage utility [Fig. 25] :
Figure 25: Result of the inverse FFT after the high spatial frequency
components have been masked out (low pass filter)
37. Once finished viewing the inverse FFT image, close the IDL iImage window.
The high spatial frequency components of an image can also be enhanced using
masking techniques in the frequency domain. A circular-cut (high pass) filter can
be created by utilizing the DIST function in IDL and the appropriate threshold value :
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 32 of 34
38. IDL> hsfMask = DIST (500) GE 50
Visualize this mask by shifting it into the appropriate location and loading the result
into the iImage utility [Fig. 26] :
Figure 26: Circular-Cut filter for the high spatial frequency components
(white) within the image
Notice that the high frequency components are found around the outer edges of the
transform.
40. Once finished viewing the mask image, close the IDL iImage window.
Use the same methodology as before to apply the high pass filter, compute the
inverse FFT, and display the result :
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 33 of 34
45. IDL> gInvert = REAL_PART (FFT (gMasked, /INVERSE) )
46. IDL> bInvert = REAL_PART (FFT (bMasked, /INVERSE) )
47. IDL> iImage, RED=rInvert, GREEN=gInvert, BLUE=bInvert
The resulting IDL iImage visualization window should look similar to Fig. 27.
Figure 27: Result of the inverse FFT after the low spatial frequency
components have been masked out (high pass filter)
48. Once finished viewing the inverse FFT image, close the IDL iImage window.
IDL® is a registered trademark of ITT Visual Information Solutions for the computer software described
herein and its associated documentation. All other product names and/or logos are trademarks of their
respective owners.
The information contained in this document pertains to software products and services that are subject to
the controls of the Export Administration Regulations (EAR). All products and generic services described
have been classified as EAR99 under U.S. Export Control laws and regulations, and may be re-transferred
to any destination other than those expressly prohibited by U.S. laws and regulations. The recipient is
responsible for ensuring compliance to all applicable U.S. Export Control laws and regulations.
ITT Visual Information Solutions • 4990 Pearl East Circle Boulder, CO 80301
P: 303.786.9900 • F: 303.786.9909 • www.ittvis.com
Page 34 of 34