Tutorial 3
Tutorial 3
Multispectral
Classification
The following topics are covered in this tutorial:
ENVI Tutorials 89
90 Tutorial 3: Multispectral Classification
File Description
can_tmr.img Boulder Colorado TM Reflectance
can_tmr.hdr ENVI Header for Above
can_km.img K MEANS Classification
can_km.hdr ENVI Header for Above
can_iso.img ISODATA Classification
can_iso.hdr ENVI Header for Above
classes.roi Regions of Interest (ROI) for Supervised
Classification
can_pcls.img Parallelepiped Classification
can_pcls.hdr ENVI Header for Above
can_bin.img Binary Encoding Result
can_bin.hdr ENVI Header for Above
can_sam.img SAM Classification Result
can_sam.hdr ENVI Header for Above
can_rul.img Rule image for SAM classification
can_rul.hdr ENVI Header for Above
can_sv.img Sieved Image
File Description
can_sv.hdr ENVI Header for Above
can_clmp.img Clump of sieved image
can_clmp.hdr ENVI Header for Above
can_comb.img Combined Classes image
can_comb.hdr ENVI Header for Above
can_ovr.img Classes overlain on gray scale image
can_ovr.hdr ENVI Header for Above
can_v1.evf Vector layer generated from class #1
can_v2.evf Vector layer generated from class #2
Start ENVI
Before attempting to start the program, ensure that ENVI is properly installed as
described in the installation guide.
• To start ENVI in UNIX, enter envi at the UNIX command line.
• To start ENVI from a Windows or Macintosh system, double-click on the
ENVI icon.
The ENVI main menu appears when the program has successfully loaded and
executed.
3. Select the RGB Color radio button in the Available Bands List, and then
click on bands 4, 3, and 2 sequentially with the left mouse button.
The bands you have chosen are displayed in the appropriate fields in the center
of the dialog.
4. Click on the Load RGB button to load the image into a new display.
Cursor Location/Value
Use ENVI’s Cursor Location/Value dialog to preview image values in the displayed
spectral bands. To bring up a dialog box that displays the location of the cursor in the
Main Image, Scroll, or Zoom windows.
1. Select Tools → Cursor Location/Value from the Main Image window menu
bar.
Alternatively, double-click the left mouse button in the image display to toggle
the Cursor Location/Value dialog on and off.
2. Move the cursor around the image and examine the data values in the dialog
for specific locations. Also note the relation between image color and data
value.
3. Select Files → Cancel in the Cursor Location/Value dialog to dismiss when
finished.
Unsupervised Classification
Start ENVI’s unsupervised classification routines from the ENVI main menu, by
choosing Classification → Unsupervised → K-Means or IsoData, or review the
pre-calculated results of classifying the image in the can_tm directory.
K-Means
Unsupervised classification uses statistical techniques to group n-dimensional data
into their natural spectral classes. The K-Means unsupervised classifier uses a cluster
analysis approach which requires the analyst to select the number of clusters to be
located in the data, arbitrarily locates this number of cluster centers, then iteratively
repositions them until optimal spectral separability is achieved.
Choose K-Means as the method, use all of the default values and click on OK, or
review the results contained in can_km.img.
1. Open the file can_km.img, click on the Gray Scale radio button in the
Available Bands List, click on the band name at the top of the list, select New
Display on the Display button pull-down menu, and then Load Band.
2. From the Main Image display menu, select Tools → Link → Link Displays
and click OK in the dialog to link the images.
3. Compare the K-MEANS classification result to the color composite image by
clicking and dragging using the left mouse button to move the dynamic
overlay around the image.
4. When finished, select Tools → Link → Unlink Display to remove the link
and dynamic overlay.
If desired, experiment with different numbers of classes, change thresholds, standard
deviations, and maximum distance error values to determine their effect on the
classification.
Isodata
IsoData unsupervised classification calculates class means evenly distributed in the
data space and then iteratively clusters the remaining pixels using minimum distance
techniques. Each iteration recalculates means and reclassifies pixels with respect to
the new means. This process continues until the number of pixels in each class
changes by less than the selected pixel change threshold or the maximum number of
iterations is reached.
Choose IsoData as the method, use all of the default values and click on OK, or
review the results contained in can_iso.img.
1. Open the file can_iso.img, click on the Gray Scale radio button in the
Available Bands List, click on the band name at the top of the list, select the
Display #1 button and choose New Display on the pull-down menu. Then
click on the Load Band button.
2. Select Tools → Link → Link Displays. Click OK to link this image to the
color composite image and the K-MEANS result.
3. Compare the IsoData classification result to the color composite image by
clicking and dragging using the left mouse button to move the dynamic
overlay around the image. Toggle the dynamic overlay of the third image by
holding the left mouse button down and simultaneously clicking on the middle
mouse button. Compare the ISODATA and K-MEANS classifications.
4. Select File → Cancel to dismiss the two image displays.
If desired, experiment with different numbers of classes, change thresholds, standard
deviations, maximum distance error, and class pixel characteristic values to
determine their effect on the classification.
Supervised Classification
Supervised classification requires that the user select training areas for use as the
basis for classification. Various comparison methods are then used to determine if a
specific pixel qualifies as a class member. ENVI provides a broad range of different
classification methods, including Parallelepiped, Minimum Distance, Mahalanobis
Distance, Maximum Likelihood, Spectral Angle Mapper, Binary Encoding, and
Neural Net. Examine the processing results below, or use the default classification
parameters for each of these classification methods to generate your own classes and
compare results.
To perform your own classifications from the ENVI main menu, select
Classification → Supervised → [method], where [method] is one of the supervised
classification methods in the pull-down menu (Parallelepiped, Minimum Distance,
Mahalanobis Distance, Maximum Likelihood, Spectral Angle Mapper, Binary
Encoding, or Neural Net). Use one of the two methods below for selecting training
areas, also known as regions of interest (ROIs).
Select Training Sets Using Regions of Interest (ROI)
As described in Tutorial 1, “Introduction to ENVI” and summarized here, ENVI lets
you easily define regions of interest (ROIs) typically used to extract statistics for
classification, masking, and other operations. For the purposes of this exercise, you
can either use predefined ROIs, or create your own.
Restore Predefined ROIs
1. Use pre-selected regions of interest by starting the #1 ROI Tool dialog by
choosing from the #1 Main Image menu bar Overlay → Region of Interest.
2. In the #1 ROI Tool dialog choose File → Restore ROIs.
3. The Enter ROI Filename dialog opens. Select CLASSES.ROI as the input file
to restore.
Create Your Own ROIs
1. Select Overlay → Region of Interest from the Main Image window menu
bar. The ROI Tool dialog for the display group appears.
2. In the Main Image window draw a polygon that represents the new region of
interest. To accomplish this, do the following.
• Click the left mouse button in the Main Image window to establish the first
point of the ROI polygon.
• Select further border points in sequence by clicking the left button again,
and close the polygon by clicking the right mouse button.The middle
mouse button deletes the most recent point, or (if you have closed the
polygon) the entire polygon. Fix the polygon by clicking the right mouse
button a second time.
• ROIs can also be defined in the Zoom and Scroll windows by choosing the
appropriate radio button at the top of the ROI Controls dialog.
When you have finished defining an ROI, it is shown in the dialog’s list of
Available Regions, with the name, region color, and number of pixels
enclosed, and is available to all of ENVI’s classification procedures.
3. To define a new ROI, click the New Region button.
• You can enter a name for the region and select the color and fill patterns
for the region by clicking on the Edit button to bring up the Edit ROI
Parameters dialog. Define the new ROI as described above.
Classical Supervised Multispectral Classification
The following methods are described in most remote sensing textbooks and are
commonly available in today’s image processing software systems.
Parallelepiped
Parallelepiped classification uses a simple decision rule to classify multispectral data.
The decision boundaries form an n-dimensional parallelepiped in the image data
space. The dimensions of the parallelepiped are defined based upon a standard
deviation threshold from the mean of each selected class.
1. Pre-saved results are in the file can_pcls.img. Examine these or perform
your own classification using the CLASSES.ROI regions of interest described
above. Try using the default parameters and various standard deviations from
the mean of the ROIs.
2. Use image linking and dynamic overlay to compare this classification to the
color composite image and previous unsupervised classifications.
Maximum Likelihood
Maximum likelihood classification assumes that the statistics for each class in each
band are normally distributed and calculates the probability that a given pixel belongs
to a specific class. Unless a probability threshold is selected, all pixels are classified.
Each pixel is assigned to the class that has the highest probability (i.e., the maximum
likelihood).
1. Perform your own classification using the CLASSES.ROI regions of interest
described above. Try using the default parameters and various probability
thresholds.
2. Use image linking and dynamic overlay to compare this classification to the
color composite image and previous unsupervised and supervised
classifications.
Minimum Distance
The minimum distance classification uses the mean vectors of each ROI and
calculates the Euclidean distance from each unknown pixel to the mean vector for
each class. All pixels are classified to the closest ROI class unless the user specifies
Figure 3-5: Rule Image for Canon City Landsat TM, Spectral Angle Mapper
Classification. Stretched to show best matches (low spectral angles) as bright
pixels.
The rule image pixel values represent different things for different types of
classifications, for example:
1. For the SAM classification above, load the classified image and the rule
images into separate displays and compare using dynamic overlays. Invert the
SAM rule images using Tools → Color Mapping → ENVI Color Tables and
dragging the Stretch Bottom and Stretch Top sliders to opposite ends of the
dialog. Areas with low spectral angles (more similar spectra) should appear
bright.
2. Create classification and rule images using the other methods. Use dynamic
overlays and Cursor Location/Value to determine if better thresholds could
be used to obtain more spatially coherent classifications.
3. If you find better thresholds, select Classification → Post
Classification → Rule Classifier from the ENVI main menu.
4. Double-click the can_tmr.sam input file to bring up the Rule Image
Classifier Tool, enter a threshold to create a new classified image. Compare
your new classification to the previous classifications.
Class Statistics
This function allows you to extract statistics from the image used to produce the
classification. Separate statistics consisting of basic statistics (minimum value,
maximum value, mean, std deviation, and eigenvalue), histograms, and average
spectra are calculated for each class selected.
1. Choose Classification → Post Classification → Class Statistics to start the
process and select the Classification Image can_pcls.img and click OK.
2. Next select the image used to produce the classification can_tmr.img and
click OK.
3. Use the Class Selection dialog to choose the classes for statistics. Click on
Select All Items, then OK.
4. Finally, choose the statistics to be calculated in the Compute Statistics
Parameters dialog, click OK at the bottom of the Compute Statistics
Parameters dialog.
Several plots and reports will appear, depending on the statistics options selected.
Confusion Matrix
ENVI’s confusion matrix function allows comparison of two classified images (the
classification and the “truth” image), or a classified image and ROIs. The truth image
can be another classified image, or an image created from actual ground truth
measurements.
Overlay Classes
Overlay classes allows the user to place the key elements of a classified image as a
color overlay on a gray scale or RGB image.
1. Examine the pre-calculated image can_ovr.img or create your own
overlay(s) from the can_tmr.img reflectance image and one of the classified
images above.
2. Select Classification → Post Classification → Overlay Classes from the
ENVI main menu.
3. Choose the current display as an input for class overly from the Available
Bands List dialog.
4. Select can_tmr.img band 3 for each RGB band (band 3 for the R band,
band 3 for the G band, and band 3 for the B band) in the Input Overlay RGB
Image Input Bands dialog and click OK.
5. Use can_comb.img as the classification input in the Classification Input File
dialog.
6. Click OK and then choose Region #1 and Region #2 in the Class Overlay to
RGB Parameters dialog to overlay on the image. Output to memory and click
OK to complete the overlay.
7. Load the overlay image into an image display and compare with the classified
image and the reflectance image using linking and dynamic overlays.
4. Click in each On check box to change the display of each class as an overlay
on the gray scale image.
5. Try the various options for assessing the classification under the Options
menu.
6. Choose various options under the Edit menu to interactively change the
contents of specific classes.
7. Select File → Save Image As → [Device] in the Main Image window (where
[Device] is either Postscript or Image) to burn in the classes and output to a
new file.
8. Select File → Cancel to exit the interactive tool.
Edit Layers to change the colors and fill of the vector layers to make them
more visible.
If you are using ENVI RT, quitting ENVI will take you back to your operating
system.