Classification Exercise in envi
Geog2021
Lewis
RSU, Dept. Geography
Introduction
The aim of this practical is for you to gain experience in the
supervised classification of Eath Observation (EO) imagery, using envi
software. At the end of this practical, you should be able to analyse
multispectral EO data for the purpose
of classsification, derive statical descriptions of training classes,
and apply these to achieve categorisation (classification) of the data.

Image data
Refer to the basic
UNIX commands page for help if required. Type the following
commands
:
machine% cd Data
machine% mkdir classification
machine% cp
~plewis/classification/ETM-* classification
machine% cp ~plewis/classification/TM-* classification
machine% cp ~plewis/classification/SRTM-2002* classification
machine% cd classification
machine% ls -l ETM-* TM-*
SRTM-2002*
-rw-r--r-- 1
plewis 311040000 Sep 29 15:23 ETM-110801
-rw-r--r-- 1 plewis
1237 Sep 29 15:24 ETM-110801.HDR
-rw-r--r-- 1 plewis
3339 Sep 29 14:27 ETM-110801.sta
-rw-r--r-- 1 plewis 51840000 Sep 29 15:20
SRTM-2002
-rw-r--r-- 1
plewis 544 Sep 29 15:20
SRTM-2002.HDR
-rw-r--r-- 1 plewis 311040000 Sep 29 15:22
TM-250792
-rw-r--r-- 1 plewis
1195 Sep 29 15:25 TM-250792.HDR
| 1 |
2 |
3 |
4 |
5 |
6 |
|
| 450-520 nm |
520-600 nm |
630-690 nm |
760-900 nm |
1550-1750 nm |
2080-2350 nm |
|
![]() |
![]() |
| TM 27th July
1992 |
ETM 11th
August 2001 |
![]() |
![]() |
| Map of
region shown on right (from Earthshots) |
Satellite data 1975-1992 (from Earthshots) |
| Urban May also include other 'built' structures such as roads. You should be able to recognise these from their spatial structure, even at this resolution. |
![]() |
| Forest This should be easy to spot, but there are sometime clear 'shading' effects (as in this example) that might complicate classification. |
![]() |
| Rocks Rocks are quite easily identifiable in the FCC images. You would generally expect them to be static between the two dates. |
![]() |
| Rivers There are rivers and other water bodies in the scene, which you will be able to recognise by their shape. They will be difficult to use as training sites as they are quite narrow at this resolution. |
![]() |
| Farmland You will see a broad patchwork of areas that have been cleared of forest and used to graze cattle or raise crops. The areas a quite easy to spot in the FCC images, but might represent a broad spectral class because of the various physical cover types involved. |
![]() |
| other You may spot some areas that have rather different spectral properties to most of the other areas. One example is shown here of field-shaped areas (green and purple areas) that might be inferred to be farmland, but are clearly different spectrally to other areas of farmland. We cannot really determine what these areas are from the information available, so you might require an 'other' class to cope with such eventualities. |
![]() |
| cloud The images may contain a small amount of cloud or smoke/haze, an example of which is shown here. They are quite easy to recognise visually in the FCC, but may be difficult to classify unless they are quite thick. If there are any thick clouds, you may see cloud shadows on the ground as well. |
![]() |
In order to classify the image data you are required to define a set of "signatures" which represent each class. These are then used to "train" the classification algorithm.
In envi, you need to define these classes via ROIs (Regions of Interest). The tool for defining ROIs is:



Having defined a signature set for each class, you can now use these
definitions to define a supervised classification. Various algorithms
are available under the Classification->Supervised...
menu of envi. As a start, you might like to consider a Maximum
Likelihood classification:
Classification->Supervised...->Maximum
Likelihood
First, select the image data you wish to classify. If you do not
have an ROI file currently open, you will need to open this via the Open->ROI File... option.
You now need to:
a. Decide which classes to use in the classification (Select Classes from Region);
b. Set a probability threshold for the classification (if pixels
have less than this probability of being any class, they will be
unclassified). You can set a value of None if you like, but something
like 75% (0.80) might be more appropriate (perhaps try 'None' first
time around).
c. Set a name of output files (Output
Result to File) for the Result image and probably the 'Rule
image' as well.
You can preview the result for a limited region (Preview button), then if that looks
fine, click 'OK':

Processing the classification may take a while, so whilst you are
learning about this, you may choose to work on an image subset (choose Subset Spatially when you choose the
image file to use).
You should find an output classified image:

Along with the 'rule' image (if selected).
You should examine both output datasets to guage why the classification
has worked as it has (the lower the (-ve) value in 'rule' image, the
less likely that pixel is to be the particular class, so you might for
instance find some areas which are almost as likelt to be two or more
different cover types).

After examining these results, you may
wish to go back and redefine your classes or choose new classes.
Equally, you may like to try out different classification algorithms.
You might also try out some unsupervised classification methods and/or
the SMACC Endmember Extraction routines in envi, which will attempt to
automatically define a set of 'pure' spectral classes (see envi manual
and tutorials).
You can output further information for
analysis of the result via: Classification->Post
Classification->Class Statistics.
Envi is able to calculate a confusion matrix between two classified
images or between a classified image and 'ground truth' ROIs. First
then, you must generate the ROIs for this purpose.
Once you have this new (independent) ROI dataset, select: Classification->Post Classification->Confusion
Matrix->Using Ground Truth ROIs.... Select first the
classification image you wish to assess, then in the following dialogue
match up the class names of the classified image and the 'ground truth'
ROIs:

Clicking 'OK'
through the next box results in the confusion matrix being dsiplayed.
For example:
Confusion
Matrix:
/data/rsu_raid_0/plewis/public_html/geog2021/classificationPractical/result
Overall Accuracy =
(10287/10427) 98.6573%
Kappa Coefficient = 0.9792
Ground Truth (Pixels)
Class
Forest
Rock
Urban
Farm Total
Unclassified
0
0
0
0
0
Forest
[Purpl
2140
0
0
3 2143
Rock [Blue]
1
0
1337
0
59 1396
Urban
[White]
0
0
1421
64 1485
Farm
[Green]
0
1
13
5389 5403
Total
2140
1338
1434
5515 10427
Ground Truth (Percent)
Class
Forest
Rock
Urban
Farm Total
Unclassified
0.00
0.00
0.00
0.00 0.00
Forest
[Purpl
100.00
0.00
0.00
0.05 20.55
Rock [Blue]
1
0.00
99.93
0.00
1.07 13.39
Urban
[White]
0.00
0.00
99.09
1.16 14.24
Farm
[Green]
0.00
0.07
0.91
97.72 51.82
Total
100.00
100.00
100.00
100.00 100.00
Class Commission
Omission
Commission
Omission
(Percent)
(Percent)
(Pixels)
(Pixels)
Forest
[Purpl
0.14
0.00
3/2143
0/2140
Rock [Blue]
1
4.23
0.07
59/1396
1/1338
Urban
[White]
4.31
0.91
64/1485
13/1434
Farm
[Green]
0.26
2.28
14/5403
126/5515
Class Prod. Acc. User
Acc. Prod.
Acc. User
Acc.
(Percent)
(Percent)
(Pixels)
(Pixels)
Forest
[Purpl
100.00
99.86
2140/2140
2140/2143
Rock [Blue]
1
99.93
95.77
1337/1338
1337/1396
Urban
[White]
99.09
95.69
1421/1434
1421/1485
Farm
[Green]
97.72
99.74
5389/5515
5389/5403
You should make sure that you understand
this form of output and what it is telling you about how well your
classified image matched your independent 'ground truth' data. Make
sure you understand the terms such as 'User' and 'Producer' accuracy
and other reported statistics.
You might also like to examine various
options for 'post classification filtering', such as clump and seive.
See the envi manual for more details on these operators.
If you have time, you may like to
visualise either the original data or the classified image overlain on
the SRTM topography. To do this:
Topographic->3D
Surface View
You may as well set the image resolution
to 'full' here. You may also like to increase the vertical exaggeration
for 'dramatic effect' (e.g. to 20). Using the tool should be relatively
intuitive. If not, read the envi manual on this feature.