CSTARS ENVI Tutorial
#4
Basic Hyperspectral Analysis
The following topics are covered in this tutorial:
Overview
of This Tutorial
Spectral
Libraries, Image Reflectance Spectra, ROIs, and Color Composites
Regions
of Interest
Design
Color Images to Discriminate Mineralogy
2-D
Scatterplots
References
Overview
of This Tutorial
This tutorial is designed to introduce you to
the concepts of Spectral Libraries, Region of Interest
(ROI) extraction of spectra, Directed Color composites, and
to the use of 2-D scatterplots for simple classification. We will
use 1995 Airborne Visible/Infrared Imaging Spectrometer (AVIRIS)
apparent reflectance data of Cuprite, Nevada, USA, calibrated
using the ATREM atmospheric modeling software. The subsetted data
cover the 1.99 to 2.48 mm range in 50 spectral bands approximately
10 nm wide. You will extract ROIs for specific minerals, compare
them to library spectra, and design R, G, B color composites to
best display the spectral information. You will also use 2-D scatterplots
to locate unique pixels, interrogate the data distribution, and
perform simple classification. This tutorial is designed to be
completed in two to four hours.
Files Used in This Tutorial
You must have the ENVI TUTORIALS & DATA
CD-ROM mounted on your system to access the files used by this
tutorial, or copy the files to your disk.
The files used in this tutorial are contained
in the C95AVSUB subdirectory of the ENVIDATA directory
on the ENVI TUTORIALS & DATA CD-ROM.
The files listed below, along with their associated
.hdr files, are required to run this exercise. Selected
data files have been converted from floating-point to integer
format by multiplying by 1000 to conserve disk space. Data values
of 1000 represent apparent reflectances of 1.0.
Required Files
CUP95_AT.INT Cuprite ATREM calibrated reflectance data. 50 bands (integer).
JPL1.SLI JPL Spectral Library in ENVI format.
USGS_MIN.SLI USGS Spectral Library in ENVI format.
CUP95_AV.ROI Saved ROI locations.
Spectral
Libraries and Image Reflectance Spectra
This portion of the tutorial is designed
to familiarize you with Spectral Libraries, Browsing and extraction
of image reflectance spectra, Region of Interest (ROI) definition
in ENVI, and directed design of color composite images for spectral
discrimination.
Start
ENVI and Load AVIRIS data
Before attempting to start the program, ensure
that ENVI is properly installed as described in the installation
guide.
- To open ENVI in Unix, enter "
envi " at the UNIX command line.
- To open ENVI from a Windows
or Macintosh system, d ouble-click on the ENVI icon.
The ENVI Main Menu appears when the program has
successfully loaded and executed.
- On the ENVI Main Menu, select File->Open
Image File and navigate to the C95AVSUB subdirectory
of the ENVIDATA directory on the ENVI TUTORIALS &
DATA CD-ROM.
- Choose CUP95_AT.INT as the input
file name. The Available Bands List dialog will appear, listing
the 50 spectral band names.
Display
a Grayscale Image
- Use the scroll bar on the right side of
the Available Bands List dialog to scroll through the list until
Band 193 (2.20 mm ) is displayed.
- Click on Band 193 and click "Load"
at the bottom of the dialog.
An ENVI image display containing the selected
band will appear.
- Click the right mouse button in the Main
Image window and select Functions->Profiles->Z Profile
to extract an apparent reflectance spectrum.
Browse
Image Spectra and Compare to Spectral Library
- Move the Zoom Window indicator box around
the image to browse through image apparent reflectance spectra.
- Drag the box by grabbing and dragging
with the left mouse button or click the middle mouse button in
the Main Image display to center the Zoom Indicator box on the
selected pixel.
- Position the Zoom Indicator box at various
locations in the image and examine the spectra.
- Compare apparent reflectance spectra
from the image to selected library reflectance spectra.
ENVI includes several spectral libraries.
For the purposes of this exercise, you will use the JPL Spectral
Library (Groves et al., 1992) and the USGS Spectral Library (Clarke
et al., 1993).
- Select Spectral Tools->Spectral Libraries->Spectral
Library Viewer.
- When the Spectral Library Input File
dialog appears, click "Open New File", select JPL1.SLI
from the list, and click "OK".
JPL1.SLI now appears in the "Select
Input File" field of the dialog.
- Click on the file name and click "OK"
to open the Spectral Library Viewer dialog.
- Select Options->Edit (x, y) Scale
Factors and enter a value of 1000 into Y Data Multiplier to match
the image apparent reflectance range (0 - 1000).
- Plot the following spectra in the Spectral
Library Viewer window (Figure 1) by clicking on the appropriate
mineral name in the list of spectra:
- ALUNITE SO-4A
- BUDDINGTONITE FELDS TS-11A
- CALCITE C-3D
- KAOLINITE WELL ORDERED PS-1A
- Move the Zoom Indicator Box (which is
centered on the "current pixel") to several different
areas in the image and visually compare the image and laboratory
spectra.
- Select Functions->Interactive Analysis->Pixel
Locator in the Main Image display and use it to center the Zoom
Indicator on pixel 590, 570 (Stonewall Playa).
- Enter the desired pixel location in the
Pixel Locator dialog and click "Apply" to move to that
location, which can be used as a starting point for analysis.
- Now start a new plot window by selecting
File->New Window->Inherit in the #1 Spectral Profile window.
- Drag and drop the spectrum for each site
for the exact pixels listed below from the Spectral Profile window
into the new plot window for comparison (Figure 2).
| Location Name |
Sample
(with offset)
|
Line
(with offset)
|
| Stonewall Playa |
590 |
570 |
| Varnished Tuff |
435 |
555 |
| Silica Cap |
494 |
514 |
| Opalite Zone with Alunite |
531 |
541 |
| Strongly Argillized Zone with Kaolinite |
502 |
589 |
| Buddingtonite Zone |
448 |
505 |
| Calcite |
260 |
613 |
- Click the right mouse button in the plot window to display
the spectra names, then click and hold the left mouse button
on the first letter of the name and drag the name into the plot
window before releasing the mouse button.
- Select Options->Stack Data to offset spectra vertically.
- Visually compare these spectra to the
library spectra extracted previously.
Note the similarity of shape and absorption
features between the laboratory spectra and the individual image
apparent reflectance spectra.
Based on these similarities, we conclude
that the image spectra similar to the alunite, buddingtonite,
calcite, and kaolinite laboratory spectra represent pixels predominantly
of the above minerals.

- Drag and drop spectra from the Spectral
Library Viewer into the Z-Profile window for direct comparison
using the method described above.
Identify
Spectra Using the Spectral Analyst
ENVI has a spectral matching tool that provides a score with
respect to the library spectra The spectral analyst uses
several methods to produce a score between 0 and 1, with 1 equaling
a perfect match.
- Select Spectral Tools>Spectral Analyst from the ENVI Main
Menu.
- Click on the Open Spectral Library button at the bottom of
the Spectral Analyst Input Spectral Library dialog.
- Navigate to the USGS_MIN spectral library directory and select
and open the USGS_MIN.SLI spectral library.
- When the Edit Identify Methods Weighting dialog appears,
click OK. The different matching methods are described in the
ENVI User's Guide.
- Click Apply in the Spectral Analyst dialog and click on the
spectrum to be identified in the list.
The Spectral Analyst scores the unknown spectrum against the
library. The figure below shows an identification for pixel
502, 589. Note the high number of kaolinite spectra at the
top of the list. This, and the relatively high scores indicates
a high likelihood of kaolinite.
- Now double click on the spectrum name
at the top of the list. This will plot the unknown and
the library spectrum in the same plot for comparison. Use the
Spectral Analyst and the comparison plots to verify the mineralogy
for the image spectra you have extracted. When you have
identified several minerals, continue with the next section.

- Optionally, compare spectra from the USGS
Spectral Library USGS_MIN.SLI with image spectra and the JPL
Spectral library.
Close Windows and Plots
- To close all of the previous plot windows,
select Basic Tools->Display Controls->Close All Plot Windows.
- To close these dialogs, select File->Cancel
in the Spectral Library Viewer dialog and the Pixel Locator.
Define
Regions of Interest
Regions of Interest (ROIs) are used to extract
statistics and average spectra from groups of pixels. You can
define as many ROIs as you wish in any displayed image.
- Select Basic Tools->Region of Interest->Define
Region of Interest.
- When the Region of Interest Controls
dialog appears. click in the "Display #" text box at
the top of the dialog, and enter "1" for the display
number.

Create New Region of Interest
To begin drawing an ROI:
- Click the left mouse button in the image.
- Draw the ROI by clicking the left mouse
button at the axes of a polygon, or draw continuously by clicking
and dragging the left mouse button.
- Complete the ROI by clicking the right
mouse button to close the polygon.
- Click on the Stats button to calculate
the statistics and plot a mean spectrum (white), the first standard
deviation above and below the mean spectrum (green), and the
Min/Max envelope containing all of the spectra in the ROI (red).
- Click "Cancel" in the File
Statistics Report and select File->Cancel in the Avg Spectrum
plot to close the dialog and plot respectively.
- Click "Delete" in the Region
of Interest Controls dialog to delete the selected ROI.
Load Previously Saved Regions of Interest
- Click "Restore ROIs" and select
the file CUP95_AV.ROI from the files list on the input
file dialog and click "OK".
Regions previously defined for known areas
of specific minerals will be loaded into the ROI Controls dialog
and listed in an ENVI message dialog.
- Click "OK" at the bottom of
this dialog and the ROIs will be loaded and displayed on the
#1 Display.
- Click the "Off" toggle button
at the top of the Region of Interest Controls Dialog to enable
pixel positioning within the Main Image display.
- Start a Z-Profile window by selecting
Functions->Profiles->Z-Profile in the Main Display window.
- Move the current pixel position/cursor
location into each ROI by clicking the middle mouse button on
a pixel in the ROI.
- Click on different pixels in the ROI
to move the cursor position and display a new spectral profile
in the Spectral Profile window.
Note that the y-axis plot range is automatically
rescaled to match the spectral profile for each new ROI. Examine
the spectral variability within each ROI.
Extract Mean Spectra from ROIs
- Select a ROI name in the Region of Interest
Controls dialog by clicking on the name, then click "Stats"
to extract statistics and a spectral plot of the selected ROI.
- Examine the spectral variability of each
ROI by comparing the mean spectrum (white) with the 1st standard
deviation spectra (green above and below the mean) and the envelope
spectra (red above and below the mean).
- Repeat for each ROI.
- If you wish, load the corresponding library
signatures from the JPL1.SLI library into the plot window
for direct comparison/identification.
Don't forget to use a "Y-Scaling Factor"
of 1000 when loading the library spectra.
- When you have finished, click "Cancel"
in each of the File Statistics Report dialogs.
- Select File->Cancel in each plot window
to remove these plots from the screen.
- Click "Mean All" in the Region
of Interest Controls dialog to plot the average spectrum for
each ROI in a single plot window.

- Compare the spectral features of each
spectrum and note unique characteristics that might allow identification.
- Select Options->Stack Data to offset
spectra for comparison.
- If desired, load the corresponding spectral
library signatures from the JPL1.SLI library for direct
comparison of image apparent reflectance spectra with laboratory
spectra.
Don't forget to use a Y Factor of 1000 when
loading the library spectra.
- Optionally, compare spectra from the USGS
Spectral Library USGS_MIN.SLI with image spectra and the JPL
Spectral library.
Design
Color Images to Discriminate Mineralogy
- Load a color composite image by clicking
on the "RGB Color" toggle button in the Available Bands
List and clicking sequentially on Band 183, Band 193, and Band
207.
- Click "Load RGB" to load the
color image into the current image display.
Note that the positions of the bands used
to make the RGB color composite image are marked in the Z-Profile
with vertical red, green, and blue lines.
- Click on the "Off" toggle button
in the Region of Interest Controls dialog and use the Z profiler
to browse spectra at or near your ROI locations from above.
Note where the selected RGB bands fall with
respect to spectral features in the previously displayed mean
spectra and how the spectral features affect the color observed
in the image.
- Change the plot bars in the spectral profile
to the desired bands by clicking and dragging the plot bars with
the left mouse button. (Note: one way to enhance specific materials
is by centering one color bar in an absorption feature and the
other two on opposite shoulders of the feature.)
- Double click the left mouse button within
the Z Profile plot window to load the new bands into the display
window.
After inspecting a few sites, you should
begin to understand how the color composite colors correspond
with the spectral signature. For instance, the alunitic regions
appear magenta in the RGB composite because the green band is
within the alunite absorption feature, giving a low green value,
while the red and blue bands are of almost equal reflectance.
The combination of red and blue results in a magenta color for
pixels containing alunite.
Based on the above results, try these exercises:
- Predict how certain spectra will look,
given a particular pixel's color in the RGB image.
- Explain the colors of the training sites,
in terms of their spectral features.
- Design and test specific RGB band selections
that maximize your ability to map certain minerals, like kaolinite
and calcite.
Close Plot Windows and ROI Controls
- To close all open plot windows, select
Basic Tools->Display Controls->Close All Plot Windows.
- To close the Region of Interest Control
dialog, click "Cancel".
2-D Scatterplots
Examine 2-D Scatterplots
- Start a 2-d scatterplot for the apparent
reflectance image by selecting Functions->Interactive Analysis->2-D
Scatter Plots in the Main window.
- Choose band 193 by clicking on the band
number in the "Choose Band X:" list and choose band
207 in the "Choose Band Y:" list.
- Click "OK".
After a brief wait, the scatterplot will
appear with a plot of the X vs. Y apparent reflectance values
(Figure 5).

Density Slice the Scatterplot
- Click the right mouse button in the scatterplot
to automatically density slice the scatterplot.
The colors show the frequency of occurrence
of specific apparent reflectance combinations for the two bands
being scatterplotted. White is the lowest frequency, progressing
through the colors of the rainbow to red as the highest frequency
of occurrence.
Scatterplot Dancing Pixels
- Click and drag the left mouse button in
the Main Image window to toggle "Dancing Pixels" in
the scatterplot.
The red pixels in the scatterplot correspond
to those pixels within a 10 x 10 box around the cursor in the
Main Image window.
- You can change the box-cursor size by
selecting Options->Set Patch Size in the scatter plot window.
- Move the cursor in the Main window with
the left mouse button depressed to cause the red-highlighted
pixels to change in the scatterplot display.
- Try to predict the locations of certain
image colors in the scatterplot, then check them.
Notice the shape of the red sub-scatterplot
of dancing pixels.
- Try changing the patch size and observe
the difference.
Scatterplots Linked to a Spectral Profile
- Select Options>Z Profile, select an input file from which
to extract the spectral profile, and click OK
This starts an ENVI spectral profile linked to the 2D Scatterplot.
- Position the cursor in the 2D scatterplot and click the right
mouse button to extract the spectrum for the corresponding spatial
pixel with those scatterplot characterisitcs.
- Compare spectra from the different parts of the scatterplot
and note what sorts of spectra appear at the "points"
of the plot versus the center of the plot.
Image Dancing Pixels
- Click and drag the center mouse button
in the scatterplot window over any portion of the white scatterplot
to toggle "Dancing Pixels" in the Main Image window.
The red pixels in the image correspond to
those pixels within a 10 x 10 box around the cursor in the scatterplot
window.
- You can change the box-cursor size by
selecting Options->Set Patch Size in the scatter plot window.
- Move the cursor around the scatterplot
with the middle mouse button depressed to cause the red-highlighted
pixels to change in the Main Image display.
Note the spatial distribution and coherency
of the selected pixels.
- Try changing the patch size and observe
the difference.
Scatterplot ROIs
The scatterplot tool can also be used as
a quick classifier.
- Click the left mouse button in the scatterplot
to select the first point of a Region of Interest (ROI).
- Draw a ROI polygon in the scatter plot
by selecting the desired line segments using the left mouse button.
- Click the right mouse button to close
the polygon.
Image pixels with the two-band characteristics
outlined by the polygon will be color-coded red in the Main Image
window.
- Choose another color from the Class pulldown
menu in the scatterplot window.
- Draw another polygon and the corresponding
pixels will be highlighted in the selected color on the image.
- If you want to remove a class, select
Options->Clear Class.
- You can also clear the current class by
clicking using the middle mouse button outside (below) the plot
axes.
- Use the 2-D scatterplot tool to work
backwards from the scatterplot to see where certain pixels occur
in the image.
- Classes can be converted to ROIs to act
as training sets for classification using all of the bands by
selecting Options->Export Class or Export All from the scatterplot
menu bar.
ROIs exported in this fashion will appear in the
Region of Interest Controls dialog and be available for subsequent
supervised classification.
- Select Options->Clear All in the scatterplot
to clear both scatterplot and image.
Image ROIs
The scatter plot tool also functions as a
simple classifier from the image.
- Choose Options->Image ROI in the scatterplot.
- Draw polygons in the Main Image window
(as before, click the left mouse button to draw lines and the
right button to close the polygon).
They will be mapped to the scatterplot and highlighted
in the currently selected color. After the pixels are highlighted
on the scatterplot, all of the matching pixels in the image will
be inverse mapped to the Main Image window and highlighted in
the same color, as though you had drawn the scatterplot region
yourself. This is the simplest form of 2-band classification,
but it is still a powerful tool.
- Draw a few image regions and note the
correspondence between image color and scatterplot characteristics.
Scatterplots and Spectral Mixing
- Can you explain the overall diagonal
shape of the scatterplot in terms of spectral mixing? Where do
the purest pixels in the image fall on the scatterplot? Are there
any secondary "projections" or "points" on
the scatterplot?
- Choose some other band combinations for
scatterplotting by selecting Options->Change Bands in the
scatterplot.
Try at least one pair of adjacent bands and
other pairs that are far apart spectrally.
- How do the scatterplots change shape
with different band combinations? Can you describe the n
-Dimensional "shape" of the data cloud?
- Close the scatterplot window when finished
by selecting File->Cancel in the scatterplot.
Close the Scatterplot
- To close the scatterplot window, select
File->Cancel in the scatterplot menu bar.
Close Files and Exit ENVI.
- When you have finished your ENVI session,
click "Quit" or "Exit" on the ENVI Main Menu,
then type exit at the IDL command prompt.
If you are using ENVI RT, quitting ENVI will take
you back to your operating system.
References
Clark, R. N., Swayze, G. A., Gallagher, A., King, T. V. V.,
and Calvin, W. M., 1993, The U. S. Geological Survey Digital Spectral
Library: Version 1: 0.2 to 3.0 mm: U. S. Geological Survey, Open
File Report 93-592, 1340 p.
Clark, R. N., Gallagher, A. J., and Swayze, G. A., 1990, Material
absorption band depth mapping of the imaging spectrometer data
using a complete band shape least-squares fit with library reference
spectra: in Proceedings of the Second Airborne Visible/Infrared
Imaging Spectrometer (AVIRIS) Workshop, JPL Publication 90-54,
p. 176 - 186.
Clark, R.N., T.V.V. King, M. Klejwa, G. Swayze, and N. Vergo,
1990, High Spectral Resolution Reflectance Spectroscopy of Minerals:
J. Geophys Res. 95, 12653-12680.
Grove, C. I., Hook, S. J., and Paylor, E. D., 1992, Laboratory
reflectance spectra of 160 minerals, 0.4 to 2.5 Micrometers: JPL
Publication 92-2.
Kruse, F. A., Lefkoff, A. B., and Dietz, J. B., 1993, Expert
System-Based Mineral Mapping in northern Death Valley, California/Nevada
using the Airborne Visible/Infrared Imaging Spectrometer (AVIRIS):
Remote Sensing of Environment, Special issue on AVIRIS, May-June
1993, v. 44, p. 309 - 336.
Kruse, F. A., and Lefkoff, A. B., 1993, Knowledge-based geologic
mapping with imaging spectrometers: Remote Sensing Reviews, Special
Issue on NASA Innovative Research Program (IRP) results, v. 8,
p. 3 - 28.
Copyright © 1993 - 1999, BSCLLC, All
rights reserved. ENVI is a registered trademark of Better
Solutions Consulting LLC, Lafayette, Colorado,Web: http://www.envi-sw.com,
Email: envi@bscllc.com. .(Last Update, June
03, 1999)