Lecture 10 Classification
Lecture 10 Classification
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 1 / 72
Digital Image Classification
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 2 / 72
Digital Image Classification
Digital Image
Classification
Residential
Commercial
Transportation
Green crops / grass
Forests
Bare mineral soils
Bare organic soils
Water
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 3 / 72
Digital Image Classification
The two approaches:
Per-pixel classification
• The algorithm categorizes each input pixel into
a spectral feature class based solely on its
individual multispectral vector (signature).
(signature) No
context or neighborhood evaluation is involved.
Object-oriented classification
• The input pixels are grouped into spectral
features (objects) using an image segmentation
algorithm. These objects are characterized in
both the raster and vector domains. The objects
are classified
l ifi d using
i b both
th spectral
t l and
d spatial
ti l
cues (metrics).
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 4 / 72
Digital Image Classification
The three common per-pixel methods are:
Supervised classification
Unsupervised classification
Rule-based classification
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 5 / 72
Digital Image Classification
Supervised classification
The analyst "supervises” the categorization of a set
of specific classes by providing training statistics
that identify each category.
Unsupervised classification
The raw spectral data are grouped first, based
solelyy on the statistical structure of the data. Then
the analyst must label each statistical cluster,
placing them into the appropriate categories (if
possible).
possible)
Rule-based classification
Spectrally categorized pixels are classified using
ancillary data in a GIS model.
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 6 / 72
Digital Image Classification
Supervised classification
In the imagery, the analyst identifies homogeneous,
representative examples of the various surface
cover types (information classes) of interest.
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 7 / 72
Digital Image Classification
Supervised classification
Spectral
Trainingg Sites Signatures
Conifer
mpiles
The computer sooftware com
Conifers
Water
Used to classifyy
Water all unknown
Deciduous pixels
D d
Deciduous
Digital Image
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 8 / 72
Digital Image Classification
Supervised classifiers (algorithms)
Parallelpiped – based on range or variance of class DNs
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 9 / 72
Digital Image Classification
Supervised classification process
Step 1: Define training data
Each training site should appear homogenous and
representative of the legend class
Make each training site at least 20-25 pixels (i.e., > 5 acres
for 30 meter pixels)
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 10 / 72
Digital Image Classification
Supervised classification process
Trainingg Sites
For 6-band TM & ETM imagery, the total number of
training pixels per class should be at least 600
Try to capture the landscape diversity of the class
100 100
600
pixels 100
100
100
100
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 11 / 72
Digital Image Classification
Example of a homogeneous training site
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 12 / 72
Digital Image Classification
Example of a heterogeneous training site
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 13 / 72
Digital Image Classification
Supervised classification process
Trainingg data
Should be normally distributed if the maximum
likelihood classifier is going to be used
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 14 / 72
Digital Image Classification
Supervised Classification Process
Co
Collect
ect seve
several
a training
t a g sites
s tes for
o eac
each class
c ass in order
o e to
capture the landscape diversity of the class
Deep, clear water Turbid water
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 15 / 72
Digital Image Classification
Supervised Classification Process
For variable classes do NOT merge
g signatures
g
The disadvantage of merged signatures:
shifted mean DN value (atypical of the class) and a large variance
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 16 / 72
Supervised Classification
Training Sites – Tools in ERDAS Imagine
Drawing tab: Insert Geometry Tools
Polygon tool
Region Grow tool
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 17 / 72
Supervised Classification
Polygon
tool
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 18 / 72
Supervised Classification
Drawing Tools Region Grow tool
Step 1: Set Seed Properties:
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 19 / 72
Supervised Classification
Drawing Tools Region Grow tool
Step 2: Select a seed
pixel with the Region Note excluded areas
Grow Tool:
Grown
region
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 20 / 72
Supervised Classification
Drawing Tools Region Grow tool
Step 3: Evaluate Spectral Euclidean Distance:
Signature Editor
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 22 / 72
Supervised Classification
Training Sites – Tools in ERDAS Imagine
Signature Editor Create New Signature(s) from AOI(s)
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 23 / 72
Supervised Classification
Training Sites – Tools in ERDAS Imagine
Signature Editor Evaluate each new signature
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 24 / 72
Supervised Classification
Training Sites – Tools in ERDAS Imagine
Signature Editor View Image Alarm
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 25 / 72
Supervised Classification
Signature Editor View Image Alarm
1.
2.
3.
Rationale:
at o a e Eliminate
ate the
t e most
ost atypical
atyp ca pixel
p e values
a ues from
o co
consideration.
s de at o
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 27 / 72
Supervised Classification
Visually evaluate Image Alarm for:
Errors of Omission
Errors of Commission
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 28 / 72
Supervised Classification
Errors of Omission
Indicates the need for and location of additional training
sites to adequately capture the spectral variability of the
class in question.
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 29 / 72
Supervised Classification
Errors of Commission
Indicates that the training site is not spectrally “pure”
regarding the assumed land cover/use class class.
The analyst must go back to “constrict” the training site
(spectrally) by editing the existing training polygon or
drawing a new one.
General rule: “Do no harm” ((i.e.,, it is better to leave some
pixels unclassified (omission errors) rather than to have
large commission errors).
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 30 / 72
Digital Image Classification
Maximum Likelihood Probability classifier
Without A Priori Probability Information
Decide unknown measurement vector X is in class i if, and
only if, pi > pj for all i and j out of 1... m possible classes
and
1
pi log e | Vi | X M i Vi X M i
1 T 1
2 2
Where | Vi | is the determinant of the covariance matrix , X M i T is the
transpose
p of the vector X M i and Vi 1 is the inverse of the covariance matrix .
M i is the mean measurement vector for class i, and Vi is the covariance matrix
of class i for bands k through l. Therefore, to assign the measurement vector X
of an unknown pixel to a class, the maximum likelihood decision rule computes
th value
the l pi for
f eachh class
l and d assigns
i the
th pixel i l to
t the
th class
l that
th t has
h the
th largest
l t
(or maximum) value.
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 31 / 72
Digital Image Classification
Maximum Likelihood Probability classifier
Without A Priori Probability Information
The mean vectors M i and covariance matrix Vi for each
class are estimated from the training data.
1
pi log e | Vi | X M i Vi X M i
1 T 1
2 2
Where | Vi | is the determinant of the covariance matrix , X M i T is the
transpose of the vector X M i and Vi 1 is the inverse of the covariance matrix .
M i is the mean measurement vector for class i, and Vi is the covariance matrix
of class i for bands k through l. Therefore, to assign the measurement vector X
of an unknown pixel to a class, the maximum likelihood decision rule computes
the value pi for each class and assigns the pixel to the class that has the largest
(or maximum) value.
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 32 / 72
Digital Image Classification
Maximum Likelihood Probability classifier
Unknown
Unknown p pixel 1
is assigned to
70% probability
pixels:
class H because
80% probability
•1
90% probability
p1H
1 > p1R
1 >> p1J
•2
•3 1
Unknown pixel 2
is assigned to
class R because
p2R > p2J >> p2H
Red
Unknown pixel 3
n-dimensional is assigned to
class means class R because
p3R > p3H >> p3J
NIR
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 33 / 72
Digital Image Classification
Maximum Likelihood Probability classifier
90
90
80
80 70
70 60
50
60
40
50
30
40
20
30
10
20
10
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 34 / 72
Digital Image Classification
Maximum Likelihood Probability classifier
Advantages
Sensitive to both variance and covariance in the training data
Disadvantages
Training data must be normally distributed
The per-pixel, rather than pixel neighborhood approach,
remains a problem
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 35 / 72
Digital Image Classification
Maximum Likelihood Probability classifier
Multi-band Variance,
Variance Covariance and Correlation
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 36 / 72
Digital Image Classification
Maximum Likelihood Probability classifier
Variance – Covariance Matrix
211 = 5192.16 212 = 3866.65 213 = 2722.83 214 = 1094.98
222 = 3781.67 223 = 2520.50 224 = 1462.00
233 = 4806.52 234 = 3652.66
244 = 3927.78
Sum of variances = 17708.13
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 37 / 72
Supervised Classification
Maximum Likelihood Classifier
Raster tab Classification Group Supervised
2 3
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 38 / 72
Supervised Classification
Maximum Likelihood Classifier
All pixels are classified initially, irrespective of how low the
probabilities of class membership are are.
E.g., assume the probabilities of pixel i belonging to one
of eight classes is:
p1 = 0.0125
p2 = 0.0237
p3 = 0.0105
Pixel i is assigned to Class 5 even though its
p4 = 0.0095 probability of class membership is only
p5 = 0.0275
0 0275 2.75%
2 75% (i(i.e.,
e itit’ss 97.25%
97 25% likely to NOT be a
member of Class 5 (and even less likely to be
p6 = 0.0078 a member of any other class).
p7 = 0.0083
p8 = 0.0195
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 39 / 72
Supervised Classification
Maximum Likelihood Classifier
Threshold tool (Raster tab Supervised Threshold)
Thresholding is a statistical method used to refine a supervised
classification by determining which pixels in the new thematic
raster layer are most likely to be incorrectly classified (using
the distance file that was created during the supervised
classification). These distances occur in probability space, so
larger distances are associated with lower probabilities of class
membership. p
The histogram of the distance file usually approximates a chi-
square distribution. Normally, there are many pixels with a
distance image value at or near 0, indicating that these pixels
are likely to be classified correctly. A histogram is generated
for each class in the classified image file.
Analyst displays
displays, inspects and edits (thresholds) each histogram.
histogram
The rejected pixels become “unclassified.”
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 40 / 72
Supervised Classification
Maximum Likelihood Classifier
Threshold tool (Raster tab Supervised Threshold)
Keep
Reject
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 41 / 72
Digital Image Classification
Spectral Angle Mapper
n-dimensional vectors Hyperangle < hyperangle ,
S the
So th Unknown
U k pixel
i l iis
classified as a member of
class “A”
Known A
155
Band B
255
Known B
127
0
165 255
Band A
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 42 / 72
Digital Image Classification
Spectral Angle Mapper
nb
1
tr
cos 1 /
i
2 1 / 2
t 2 r 2
nb nb
i i
i i
Where nb is the number of bands in the image, t is the unknown
pixel spectrum, and r is reference spectrum.
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 43 / 72
Digital Image Classification
Spectral Angle Mapper
Given a set of reference signatures
g collected from
an image with m bands, the SAM classifier performs
the following two steps:
– Step 1: Determine the spectral angle i,r,
between a pixel i in the image and every
reference
f class
l r: nb
1
ti,m rr ,m
i ,r cos
nb
m
nb
i ,m r ,m
t 2
r 2
m m
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 44 / 72
Digital Image Classification
Spectral Angle Mapper
– Step 2: Assign each pixel to the reference class r
that has the smallest spectral angular distance
between pixel i and reference class r. For each
pixel i = 1 to n, find the reference class r such that
the i,r, is the minimum of all reference classes.
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 45 / 72
Digital Image Classification
Spectral Angle Mapper Classifier
Advantages
g
Often more accurate than maximum likelihood
Disadvantages
Numerous training spectra strongly
Band A
required to describe the illuminated
“best” mean vector for moderately
each class illuminated
dimly
illuminated
Band B
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 46 / 72
Supervised Classification
Spectral Angle Mapper
Raster tab Classification Group Supervised
2 3
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 47 / 72
Supervised Classification
Image Classification
Classificationscan always be improved - perfection is
rarely
l possible,
ibl especially
i ll using
i precise
i LULC categories
t i
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 50 / 72
Unsupervised Classification
Clusters are defined with a clustering algorithm.
The clusteringg algorithm
g has no regard
g for the
contiguity of the pixels that define each cluster
unlike the training areas for supervised
classification.
l ifi i
The Iterative Self-Organizing Data Analysis –
ISODATA clustering method uses spectral
distance and iteratively classifies the pixels.
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 52 / 72
Unsupervised Classification
ISODATA Initialization
User specified
U ifi d
number of
clusters
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 53 / 72
Unsupervised Classification
ISODATA uses minimum spectral distance to
assign a cluster for each candidate pixel.
The process begins with a user-specified number of
arbitrary cluster means (or the means of existing
signatures).
signatures)
With each iteration, the means shift to those of the clusters
in the data
data.
Because ISODATA is iterative, it is not biased to the top of
the data file
file, as are the one-pass
one pass clustering algorithms
algorithms.
The spectral distance between any candidate pixel and
each cluster mean is calculated and the pixel is assigned
to the cluster whose mean is the closest.
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 54 / 72
Unsupervised Classification
Multispectral Feature Space
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 55 / 72
Unsupervised Classification
ISODATA first pass
Initial arbitrary
multi-band means
Initial cluster
boundaries
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 56 / 72
Unsupervised Classification
ISODATA second pass
New multi-band
cluster means
New cluster
boundaries
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 57 / 72
Unsupervised Classification
ISODATA nth pass
Final multi-band
cluster means
Final cluster
boundaries
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 58 / 72
Unsupervised Classification
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 59 / 72
Unsupervised Classification
ISODATA in ERDAS Imagine
Raster tab Classification Group Unsupervised
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 60 / 72
Unsupervised Classification
ISODATA in ERDAS Imagine
Step 1 As a generall rule,
A l thi
this should
h ld bbe att
Step 5 least 3x the number of legend
classes you desire + 3 – 5 more
Step 2
Step 3
Minimum Distance = 4 – 5
Step 7 (for 8-bit images)
Maximum Merges = 10 - 15
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 61 / 72
Unsupervised Classification
ISODATA in ERDAS Imagine
Step 8
Step 9
Step 12
Set to X:1,,Y:1
(i.e., do not skip any pixels)
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 62 / 72
Unsupervised Classification
After each iteration, the normalized percentage of
pixels whose assignments
p g are unchanged
g since
the last iteration is determined.
When this number reaches T (the convergence
threshold), the program terminates.
As a QA
Q check, ensure that the program
terminated because it reached the convergence
threshold and not because it reached the
maximum number of iterations.
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 63 / 72
Unsupervised Classification
File Session View Session Log
Performing
g iteration: 1 Convergence:
g 0.000
Performing
g iteration: 3 Convergence:
g 0.525
Performing
g iteration: 5 Convergence:
g 0.920
Performing
g iteration: 7 Convergence:
g 0.949
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 64 / 72
Unsupervised Classification
20 Clusters
6 Iterations
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 65 / 72
Unsupervised Classification
Cluster Labeling Attribute Table
Right-click for
pop-up menu.
Select “Display
Attribute Table
Table”
Attribute
Table
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 66 / 72
Unsupervised Classification
Cluster Labeling Attribute Table
1. Left-click on Opacity column heading to select all
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 67 / 72
Unsupervised Classification
Cluster Labeling Attribute Table
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 68 / 72
Unsupervised Classification
Cluster Labeling Attribute Table
Inspect the
included LULC
classes in each
cluster
l t using
i ththe
SWIPE tool
(HOME tab)
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 69 / 72
Unsupervised Classification
Cluster Busting
It is common when performing unsupervised classification that
the algorithm will generate n clusters, but you have no confidence
in labeling q of them to an appropriate information class (e.g., 15
out of 30 clusters contain multiple LULC categories).
Step 1 - all the pixels associated with the 15 clusters that are mixed (e.g.,
clusters 3, 5, 6, 9, 11, 13, 15, 17, 18, 20, 22, 23, 25, 28 and 30)) are all RECODED
to a value of 1 and a binary mask file is created.
Step 2 - A mask program is run multiplying the binary mask file times the
original imagery file.
file The output of the mask program is a new multiband
image file consisting of only the pixels that could not be adequately
labeled during the initial unsupervised classification.
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 70 / 72
Unsupervised Classification
Cluster Busting
Step 3 - Perform a new unsupervised classification on the output file
f
from Step
St 22, perhaps
h requesting
ti ththe original
i i l number
b off clusters.
l t
Step 4 – Repeat Steps 1 and 2, keeping all of new clusters that are
dominated byy a single
g LCLU (e.g.,
( g , 7).
) There are likelyy still some mixed-class
clusters, but the proportion of these is definitely smaller.
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 71 / 72
Unsupervised Classification
Cluster Busting
In this hypothetical example, the final cluster map would be
composed of :
15 good clusters from the initial classification,
7 good clusters from the first cluster
cluster-busting
busting pass (recoded as values 31
to 38), and
3 good clusters from the second cluster-busting pass (recoded as values
39 to 41).
David P. Lusch, Ph.D. GEO 827 – Digital Image Processing and Analysis October 2015 72 / 72