ENVI Tutorial: Classification Methods
ENVI Tutorial: Classification Methods
Classification Methods
Table of Contents
OVERVIEW OF THIS TUTORIAL .....................................................................................................................................2
EXAMINING A LANDSAT TM COLOR IMAGE ......................................................................................................................2
Reviewing Image Colors ....................................................................................................................................3
Using the Cursor Location/Value .........................................................................................................................3
Examining Spectral Plots....................................................................................................................................4
EXPLORING UNSUPERVISED CLASSIFICATION METHODS.......................................................................................................4
Applying K-Means Classification ..........................................................................................................................4
Applying Isodata Classification............................................................................................................................5
EXPLORING SUPERVISED CLASSIFICATION METHODS ..........................................................................................................6
Selecting Training Sets Using Regions of Interest (ROI) .........................................................................................................6
Applying Parallelepiped Classification ..................................................................................................................6
Applying Maximum Likelihood Classification .........................................................................................................7
Applying Minimum Distance Classification............................................................................................................7
Applying Mahalanobis Distance Classification .......................................................................................................7
EXPLORING SPECTRAL CLASSIFICATION METHODS .............................................................................................................8
Collecting Endmember Spectra .............................................................................................................................................8
Applying Binary Encoding Classification ...............................................................................................................9
Applying Spectral Angle Mapper Classification......................................................................................................9
EXPLORING RULE IMAGES ......................................................................................................................................... 10
POST CLASSIFICATION PROCESSING ............................................................................................................................ 11
Extracting Class Statistics................................................................................................................................. 11
Generating a Confusion Matrix.......................................................................................................................... 12
Clumping and Sieving ...................................................................................................................................... 12
Combining Classes .......................................................................................................................................... 13
Overlaying Classes .......................................................................................................................................... 13
EDITING CLASS COLORS .......................................................................................................................................... 14
WORKING WITH INTERACTIVE CLASSIFICATION OVERLAYS ................................................................................................. 14
OVERLAYING VECTOR LAYERS .................................................................................................................................... 15
Converting a Classification to a Vector............................................................................................................... 15
ADDING CLASSIFICATION KEYS USING ANNOTATION ........................................................................................................ 15
ENDING THE ENVI SESSION ..................................................................................................................................... 16
Tutorial: Classification Methods
File Description
can_tmr.img Caon City, Colorado TM reflectance image
can_tmr.hdr ENVI header for above
can_km.img K-meansf 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
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
Before attempting to start the program, ensure that ENVI is properly installed as described in the Installation Guide that
shipped with your software.
1. From the ENVI main menu bar, select File Open Image File.
2. Navigate to the envidata\can_tm directory, select the file can_tmr.img from the list, and click Open. The
Available Bands List appears on your screen.
3. Click on the RGB Color radio button in the Available Bands List. Red, Green, and Blue fields appear in the middle
of the dialog.
2
ENVI Tutorial: Classification Methods
Tutorial: Classification Methods
4. Select Band 4, Band 3, and Band 2 sequentially from the list of bands at the top of the dialog by clicking on
the band names. The band names are automatically entered in the Red, Green, and Blue fields.
5. Click Load RGB to load the image into ENVI.
6. Examine the image in the display group.
3
ENVI Tutorial: Classification Methods
Tutorial: Classification Methods
Examining Spectral Plots
Use ENVIs integrated spectral profiling capabilities to examine the
spectral characteristics of the data.
1. From the Display group menu bar, select Tools Profiles
Z Profile (Spectrum) to begin extracting spectral
profiles.
2. Examine the spectra for areas that you previewed above
using color images and the Cursor/Location Value dialog by
clicking the left mouse button in any of the display group
windows. Note the relations between image color and
spectral shape. Pay attention to the location of the image
bands in the spectral profile, marked by the red, green, and
blue bars in the plot.
3. From the Spectral Profile dialog menu bar, select File
Cancel.
4
ENVI Tutorial: Classification Methods
Tutorial: Classification Methods
Applying ISODATA Classification
ISODATA unsupervised classification calculates class means evenly distributed in the data space 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.
1. From the ENVI main menu bar, select Classification Unsupervised IsoData, or review the pre-
calculated results of classifying the image by opening the can_iso.img file in the can_tm directory.
2. Select the can_tmr.img file and click OK. The ISODATA Parameters dialog appears.
3. Accept the default values, select the Memory radio button, and click OK. The new band is loaded into the
Available Bands List.
4. From the Available Bands List, click the Display #2 button and select New Display.
5. Select the ISODATA band and click Load Band.
6. From the Display group menu bar, select Tools Link Link Displays. The Link Displays dialog appears.
7. Click the Display #2 toggle button to select No, and click the Display #3 toggle button to select Yes. Click OK
to link the images.
8. Compare the ISODATA classification result to the color-composite image using the dynamic overlay feature in
ENVI (click using the left mouse button in the Image window).
9. From the Display group menu bar, select Tools Unlink Displays.
10. From the Display group menu bar, select Tools Link Link Displays. The Link Displays dialog appears.
11. Click the Display #1 toggle button to select No, and ensure that the Display #2 and Display #3 toggle
buttons say Yes. Click OK to link and compare the K-means and ISODATA images.
12. 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.
13. From the Display group menu bar on the K-Means Image window, select File Cancel to close the display
group. Close the ISODATA display group using the same technique.
5
ENVI Tutorial: Classification Methods
Tutorial: Classification Methods
Exploring Supervised Classification Methods
Supervised classification can be used to cluster pixels in a dataset into classes corresponding to user-defined training
classes. This classification type requires that you 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. In this tutorial, you will experiment with two
methods for selecting training areas, also known as regions of interest (ROIs).
6
ENVI Tutorial: Classification Methods
Tutorial: Classification Methods
6. From the Available Bands List, click the Display #1 button and select New Display.
7. Select the Parallel band and click Load Band.
8. From the Display group menu bar, select Tools Link Link Displays and click OK in the dialog to link the
images.
9. Use image linking and dynamic overlay to compare this classification to the color composite image.
7
ENVI Tutorial: Classification Methods
Tutorial: Classification Methods
method. All pixels are classified to the closest ROI class unless you specify a distance threshold, in which case some pixels
may be unclassified if they do not meet the threshold.
1. Using the steps above as a guide, perform a Mahalanobis Distance classification.
2. Try using the default parameters and various maximum distance errors.
3. Use image linking and dynamic overlay to compare this classification to the color composite image and previous
unsupervised and supervised classifications.
4. When you are finished, close all classification display groups.
8
ENVI Tutorial: Classification Methods
Tutorial: Classification Methods
Applying Binary Encoding Classification
The binary encoding classification technique encodes the data and endmember spectra into zeros and ones, based on
whether a band falls below or above the spectrum mean. An exclusive OR function compares each encoded reference
spectrum with the encoded data spectra, and ENVI produces a classification image. All pixels are classified to the
endmember with the greatest number of bands that match unless the user specifies a minimum match threshold, in
which case some pixels may be unclassified if they do not meet the criteria.
1. From the Endmember Collection:Parallel dialog menu bar, select Algorithm Binary Encoding or review the
pre-calculated results of classifying the image by opening the can_bin.img file in the can_tm directory. These
results were created using a minimum encoding threshold of 75%.
2. For this exercise, you will use the predefined ROIs in the
classes.roi file that you used on page 6. From the
Endmember Collection:Parallel dialog menu bar, select
Import from ROI/EVF from input file. The Select
Regions for Stats dialog appears.
3. Click the Select All Items button, and click OK.
4. In the Endmember Collection:Parallel dialog, click Select
All then click Plot to view the endmember spectral plots
for the ROIs collected in the Endmember Collections
dialog.
5. In the Endmember Collections dialog click Apply. The
Binary Encoding Parameters dialog appears.
6. In the Binary Encoding Parameters dialog, select to output
the result to Memory using the radio button provided.
7. Toggle the Output Rule Images to No, then click OK to start the classification. The new band is loaded into the
Available Bands List.
8. From the Available Bands List, select the Bin Encode band, and click Load Band.
9. Use image linking and dynamic overlay to compare this classification to the color composite image and previous
unsupervised and supervised classifications.
9
ENVI Tutorial: Classification Methods
Tutorial: Classification Methods
The rule image pixel values represent different things for different types of classifications, for example:
1. From the ENVI main menu bar, select File Open Image
File.
2. Navigate to the envidata\can_tm directory, select the file
can_rul.img from the list, and click Open. The Available
Bands List appears on your screen.
3. Click on the Gray Scale radio button in the Available Bands
List and open each Rule band into its own image window
(use the Display New Display button).
4. Use image linking and dynamic overlay to compare the color
composite image to the rule images.
5. From the Display group menu bar, select Tools Color
Mapping ENVI Color Tables and drag the Stretch
Bottom and Stretch Top sliders to opposite ends of the dialog.
Areas with low spectral angles (more similar spectra) appear
bright.
10
ENVI Tutorial: Classification Methods
Tutorial: Classification Methods
11
ENVI Tutorial: Classification Methods
Tutorial: Classification Methods
Generating a Confusion Matrix
ENVIs 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. In this exercise, you will compare the Parallelepiped and SAM classification images using the
Parallelepiped classification image as the ground truth.
1. From the ENVI main menu bar, select Classification Post Classification Confusion Matrix Using
Ground Truth Image. The Classification Input File dialog appears.
2. Select the can_pcls.img file and click OK. The Ground
Truth Input File appears.
3. Click the Open drop-down button and select New File.
4. Navigate to the envidata\can_tm directory, select the file
can_sam.img from the list, and click Open.
5. Select the can_sam.img file in the Ground Truth Input File
dialog and click OK. The Match Classes Parameters dialog
appears.
6. Select Region #1 from both fields and click Add
Combination. Continue to pair corresponding classes from
the two images in this way, then click OK. The Confusion
Matrix Parameters dialog appears.
7. Click the Output Result to Memory radio button then click
OK.
8. Examine the confusion matrix and confusion images (in the
Available Bands List). Determine sources of error by
comparing the classified image to the original reflectance
image using dynamic overlays, spectral profiles, and Cursor
Location/Value.
12
ENVI Tutorial: Classification Methods
Tutorial: Classification Methods
Combining Classes
The Combine Classes function provides an alternative method for classification generalization. Similar classes can be
combined to form one or more generalized classes.
1. From the ENVI main menu bar, select Classification Post Classification Combine Classes or review
the pre-calculated results of classifying the image by opening the can_comb.img file in the can_tm directory.
The Classification Input File dialog appears.
2. Select the can_sam.img file and click OK. The Combine Classes Parameters dialog appears.
3. Select Region #3 from the Select Input Class field, click Unclassified from the Select Output Class field, click
Add Combination, then click OK. The Combine Classes Output dialog appears.
4. Click the Output Result to Memory radio button then click OK. The image is loaded into the Available Bands
List.
5. Using image linking and dynamic overlays, compare the combined class image to the classified images and the
generalized classification image.
Overlaying Classes
Overlay classes allow you to place the key elements of a classified image as a color overlay on a gray scale or RGB image.
You can examine the pre-calculated image can_tm\can_ovr.img or create your own overlay(s) from the
can_tmr.img reflectance image and one of the classified images.
1. From the ENVI main menu bar, select Classification Post Classification Overlay Classes or review the
pre-calculated results of classifying the image by opening the can_comb.img file in the can_tm directory. The
Input Overlay RGB Image Input Bands dialog appears.
2. Under can_tmr.img in the Available Bands List, select 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) and click OK. The Classification Input File dialog appears.
3. Click Open, and select New File. A file selection dialog appears.
4. Open can_tm\can_comb.img, and click Open.
5. Click OK in the Classification Input File dialog.
6. Using the Shift key on your keyboard, select Region #1 and Region #2 in the Class Overlay to RGB
Parameters dialog.
7. Click the Output Result to Memory radio button, then click OK. The image is loaded into the Available Bands
List.
8. Load the overlay image to a new display group.
9. Using image linking and dynamic overlays, compare this image to the classified image and the reflectance image.
13
ENVI Tutorial: Classification Methods
Tutorial: Classification Methods
14
ENVI Tutorial: Classification Methods
Tutorial: Classification Methods
Overlaying Vector Layers
You can load pre-calculated vector layers onto a gray scale reflectance image for comparison to raster classified images,
or convert one of the classification images to vector layers.
1. Load the can_clmp.img into a display group.
2. From the Display group menu bar, select Overlay Vectors. The Vector Parameters: Cursor Query dialog
appears.
3. From the Vector Parameters: Cursor Query dialog menu bar, select File Open Vector File.
4. Navigate to the envidata\can_tm directory, and use the Shift key on your keyboard to select the files
can_v1.evf and can_v2.evf. Click Open. The vectors derived from the classification polygons will outline the
raster classified pixels.
15
ENVI Tutorial: Classification Methods
Tutorial: Classification Methods
Ending the ENVI Session
You can quit your ENVI session by selecting File Exit from the ENVI main menu.
16
ENVI Tutorial: Classification Methods