Environmental Remote Sensing
Forestry 753
Lab Four: Unsupervised Classification
Introduction
This lab describes how to generate an unsupervised classification of an image file. Using IMAGINE, you will create a thematic raster layer by letting the software identify statistical patterns in the selected data.
Clustering
Band Selection:
In this exercise we will use the tm_data/raleigh94_alb.img scene, which you should open in a viewer.
To reduce the amount of time needed to run the unsupervised classification, you will need to decide on three TM bands to use. Not only will this reduce the processing time, but you will also learn how to "subset" an image and you can compare results and see the effect of using different band combinations. More bands (spectral data as well as ancillary data such as topographic information) could be used but processing time (and expense) goes up. Your choice of bands can be based on the work you've done (in Lab 1) displaying false color composites (e.g. 4,3,2 and 5,4,3 are likely subsets to use). If the false color composite showed a lot "apparent classes", then there is reason to believe that the colors making up that composite will produce a better unsupervised classification than a less "colorful" false color composite that does not show much color variation in different features.
Recall that if you displayed each band of your file as a gray-scale image, you will notice TM band 6 appeared "fuzzy" compared to the other bands. This is because band 6 has a spatial resolution of 120 m compared to the 28.5 m resolution of the other bands. So, this band should only be used, at least for this exercise, if you are interested in some characteristic that can be identified by its thermal properties.
Subset your image
To do the classification on only three bands, we will need to first use the Imagine "subset" utility. The unsupervised classification algorithm operates on an entire file. The '94 TM image contains 7 bands. To so the unsupervised classification on only three band you need to create a separate image that contains only the three band you decide to use.
Subset copies a selected subset of the data layers in an input file into an output file. Left-click on Image Interpreter/Utilities/Subset starting by clicking on the Image Interpreter box from the main icon panel
You should see this dialog box:
When the subset dialog appears, you need to specify the following:
a. input file directory and file
name
b. an output file name (IMAGINE automatically adds .img)
c. the TM bands you want to input; enter as a comma separated list, or enter
a range of layers using a colon
For all other parameters, you can accept the default. Although we will not use them here, note from the dialog box that you can also subset base on an area and you can use the subset utility to change the the data type.
Once you have specified the subset file name and the bands to be used, left-click on the OK button to close this dialog box and run the program.
Classify your image using ISODATA method
IMAGINE uses the ISODATA (Iterative Self-Organizing Data Analysis Technique) algorithm to perform an unsupervised classification, or clustering, of the image pixels into spectral clusters. Each cluster represents a group of pixels which have similar spectral characteristics in the input bands. The ISODATA clustering method starts by arbitrarily establishing N cluster means based on the means and standard deviations of the bands in the input file. ("N" is a number specified by the user.) A minimum distance criteria is then used to assign each pixel to the "nearest" cluster. The cluster means are then recalculated and each individual pixel is again compared to the new cluster means and assigned to the nearest cluster. For a complete description of the ISODATA decision rules, refer to the ERDAS Field Guide.
But before we do the ISODATA unsupervised classification. Let's look at the spectral distribution of the subset image. This will give us some insight on how the data are "clumped" together and, from this, how much you can expect of the unsupervised classification.
Left-click Classification/Feature Space Image which should give you the "Create Feature Space Images" dialog box:

Feature space images are the two dimensional images that are often used in textbooks (and in class) to describe how reflectance values are mapped into the two-dimensional space of two bands. By specifying your subset image as the input you should get as total of 3 "FS Image"s listed in the dialog box - which is one FS Image for each pairwise combination of the three bands in the subset image. (In statistical/combinatorial jargon, "3 choose 2 = 3".) The names of the output images are shown in the dialog box under "Output File Names", you will need to specify the directory for the output images in the "Output Root Name" window. Make sure to note which band will be along the "X" axis and which will be along the "Y" axis on the output images. Turn "on" the Output to Viewer option so you will automatically see the results. After this and after you type in your subset image and specify the output root directory, run the program. When it is done three viewer will open and you should get something like this:
If you do not understand what the X and Y axis represents, or the general interpretation of these plots, ask the lab instructor for an explanation.
Do the plots give any indication of a clear separation for the reflectance values? Classification is really a way to divide the spectral space into compartments so that the pixels falling in those compartments make sense and are consistent with the classification system of interest. If it does not seem clear how to divide the spectral space, don't worry - it never does! (At least not too much.)
Now that we have done some exploratory data analysis, lets do an unsupervised classification.
Left-click Classification/Unsupervised Classification from the main icon panel to open this dialog box. For this dialog, you will need to specify:
a. input file directory and file
name
b. output cluster file name (.img is automatically added)
c. number of clusters (or spectral classes; N)
c. maximum iterations
e. output signature file name (IMAGINE automatically adds .sig)

The number of classes may be set in the range of 20 - 30 for your first run, and increased on a subsequent run if necessary. Maximum iterations is the maximum number of times that the ISODATA program should re-cluster the data. This parameter prevents the program from running too long, or from potentially getting "stuck" in a cycle without reaching the convergence threshold. A setting of 25 is appropriate for the initial run. If ISODATA fails to meet the convergence threshold in less than 25 iterations, you may want to consider changing your input bands (i.e. use a different subset of the original TM bands) before you try increasing the number iterations. The number of iterations should not exceed 50.
Click on the Initializing Options button and turn on the Principal Axis as the way to "Initialize Means Along:". This options specifies that the initial class clusters begin along a line that defines the correlation between bands. The alternative is to start along a 45-degree line. Starting along the "Principal Axis" allows the classification to exploit the data to its fullest.
For all other parameters, accept the default. Left-click OK to start the classification process. Watch the progress bar to see how many iterations the program actually required before meeting the convergence threshold. Note that the output file will contain a single data layer and the value in each pixel will be a cluster number.
Identifying Classes
1. Display the resultant *.img file:
To view the *.img file of spectral clusters, use File/Open/Raster. from a viewer window. The output file (just one layer) will have a default "Pseudo Color" gray scale color scheme. Once the black and white image appear, give it some color by selecting Raster/Attribute Editor and click on the box that says Color . Then select Edit/Colors/Apply This should make the different "Unsupervised Classes" more apparent. An example of an image with only five classes is given below:
2. Simultaneously display the original TM image:
Open additional viewers to display the original TM image. It would be best to open the standard false color composite (4, 3, 2) as well as a composite consisting of the three bands from your subset image, if different.
3. Display cursor:
Move the cursor (arrow) to the Viewer displaying the file of spectral clusters (that is the image you just made), and, left click on Utility/Inquire Cursor to bring a cursor (cross-hair) into this display window. You can determine the cluster number which corresponds to the position of the display cursor by checking the cursor information dialog box. Note that the display window magnify' can be used in conjunction with Viewer/Inquire cursor, but cursor movement and magnifier movement are independent of each other.
4. Link the images in the two Viewers:
To link the Viewers, left-hold View / Link/Unlink Viewers / Geographical Note the icon which appears in the Viewer and the information window in the upper left corner of your screen. Move the cursor to the one of the viewers with the original image and left-click. A cursor (cross-hair) should appear in the second viewer. The two viewers will be linked and the two cursors will point to the same geographic location in each image. Note: Linked images must always be of the same dimensions, and, if georeferenced, must cover the same area. If one image is not georeferenced, it cannot be linked with a georeferenced image even if they cover the same area. The cursor information dialog box will display information on either Viewer, depending on which cross-hair you last left-clicked.
5. Interpreting the clusters:
Use the Raster/ Attribute Editor to analyze each cluster, one at a time. The dialog box looks like this:
First, set all clusters to appear in black. Then, select one single cluster to turn white (or other distinctive color). Inspect 3 to 6 sites which are in this cluster and, by comparison to the TM false color composite, determine which of the following classes this cluster represents at each site. Using the USGS classification scheme try to determine which spectral clusters correspond to the different Level one classes. Within the "Raster Attribute Editor" window you can change the class names accordingly.
Note that a given cluster may represent more than one of these classes. It is up to you to decide if there is just a "little bit" of confusion, or a "major" confusion. Major confusion(s) could mean rerunning the unsupervised classification with a different subset of bands and/or a higher number of output clusters. An additional category ("unknown" or "mixed") may be added if only a small percent of the area is in clusters which are confused with several cover types.
6. Unlinking:
After you finish going through your spectral clusters, close the color editor dialog boxes (note that the last "color table" you saved is now part of the file and your clusters will appear in these colors until you change them). Using the viewer pull-down menu, select Link/Unlink , move to the other viewers, one at a time and and left-click to "unlink". Finally, close the cursor information dialog box. Failure to unlink images may cause errors in Imagine , especially if you try to display a new image while the viewers are still linked.
Setting Color Schemes
To get a more pleasing, and perhaps more intuitive, color scheme for the unsupervised classification image use "Raster/Attribute Editor". To get the color selector (color wheel), put your cursor on a color patch in the color column, right-hold, and select Other. The color selector can be used to construct a color scheme for your spectral clusters. Or, you may use one of the primary colors provided.
In the Raster Attribute Editor , use your cursor to select the cluster which you want to color by left-clicking the cluster number in the ROW column. Or, select a range of cluster numbers by left-holding and dragging the cursor down. The selected class(es) should be highlighted in yellow.
In the Color Selector set the color you want the selected class to be. There are a multitude of ways to select colors. The RGB color selection mode is the default. You can change the combinations of Red, Green, and Blue to get different colors. For each component (R,G, or B), you can use your cursor to change its value either by moving the little squares beside each color (left-hold and drag) or by left-clicking the arrow keys. Alternatively, you can manipulate the "scroll-box" beside the color wheel to change color or brightness, or you can move the black dot inside the color wheel to change colors. There are also IHS and Color Name modes which you can explore.
After selecting the color you want, left-click on Apply to apply this color to the cluster(s) you selected in the "Raster Attribute Editor". The pixels corresponding to the selected cluster(s) will be instantly changed to the chosen color.
Finalizing the class map
Rather than renumbering or otherwise changing the file of spectral clusters so that all clusters corresponding to a given category have the same number, define a color scheme to represent clusters in one category in the same color. Use Raster/Attribute Editor to set your color scheme and save it to the file in your directory.
Review Questions:
1. Each person should produce at least one *.img file with a color map. If you have time, you can try variations such as changing the input bands of your subset image, changing the number of clusters, or trying different color schemes. Discuss factors such as input bands, number of clusters, which clusters (by number) corresponded to which category, problems encountered in trying to match the TM classification to the TM false color composite and/or the photos, or other problems in interpreting the TM classification.
2. Compare your results with what other people have done. Which areas of their images differ substantially from yours? Why do you think this is the case?
3. Try using both the SPOT and the DOQQ image data in an unsupervised classification of the same area. What effect does spatial resolution have on the resulting classifications? Which image looks "best"?
4. Consider the effects of the classification scheme on the accuracy of the classified image. Comment on appropriate types of classes with respect to image spatial and spectral resolution.
5. The ISODATA algorithm suffers from a major drawback related to its gradient descent function. What is it? (You may have to do some digging on this one.)