Image Classification: Introduction Lecture Notes 7 prepared by R. Lathrop 11/99 updated 3/04 Readings: ERDAS Field Guide 5th Ed. CH. 6:217-234 Where in the World? Learning objectives • Remote sensing science concepts – – – – Rationale and theory behind image classification Image spectral vs. information classes Unsupervised (ISODATA) algorithm Clusterbusting • Math Concepts – Calculating mage distance • Skills – Applying ISODATA algorithm Image Classification One of the major applications of remotely sensed imagery is to provide information on the amount and spatial distribution of various types of land use and land cover land cover - the biophysical material covering the land surface land use - the use to which land is put by humans Move toward more automated procedures using digital image processing to map land use-land cover Computer-assisted classification of remotely sensed images • Automatically categorize all pixels in an image into land cover classes or themes Convert image data into information • Normally uses multi-spectral data and spectral pattern recognition techniques as compared to spatial or temporal pattern recognition to aid in identification Objective: Image to Thematic Map Remotely Sensed Image Classification • 1st step: identify classification scheme to be applied • Hierarchical approach of increasing specificity Level I: most general Level II: more specific • Level of classification depends on the spatial, spectral, temporal and radiometric resolution of the image data National Land Cover Dataset Classification system: 21 classes • • • • • • • • • • • • • • • • • • Water 11 Open Water 12 Perennial Ice/Snow Developed 21 Low Intensity Residential 22 High Intensity Residential 23 Commercial/Industrial/Transportation Barren 31 Bare Rock/Sand/Clay 32 Quarries/Strip Mines/Gravel Pits 33 Transitional Forested Upland 41 Deciduous Forest 42 Evergreen Forest 43 Mixed Forest Shrubland 51 Shrubland Non-Natural Woody 61 Orchards/Vineyards/Other Herbaceous Upland Natural/Semi-natural Vegetation 71 Grasslands/Herbaceous Herbaceous Planted/Cultivated 81 Pasture/Hay 82 Row Crops 83 Small Grains 84 Fallow 85 Urban/Recreational Grasses Wetlands 91 Woody Wetlands 92 Emergent Herbaceous Wetlands http://landcover.usgs.gov/prodescription.asp Feature Space Image • Visualization of 2 bands of image data simultaneously through a 2 band scatterplot - the graph of the data file values of one band of data against the values of another band • Feature space - abstract space that is defined by spectral units N I R R e f l e c t a n c e Spectral Feature Space Red Reflectance Each dot represents a pixel; the warmer the colors, the higher the frequency of pixels in that portion of the feature space Spectral Pattern Recognition • Numerical process whereby elements of multi-spectral image data sets are categorized into a limited number of spectrally separable, discrete classes: • 1) show (train) the computer the multiple spectral band data associated with land cover type of interest • 2) the computer decides, using some form of classification decision rule, which land cover type each pixel most looks like N I R R e f l e c t a n c e Spectral Feature Space Grass Trees Classification can be Impervious thought of as trying to relate spectral classes Surface & Bare Soil or locations in the feature space with the appropriate information class water Red Reflectance Spectral vs. Information Class • Spectral class - group (cluster) of spectrally "like" pixels • Information class - land use/land cover class of interest • May take many spectral classes to describe one information class. One spectral class may represent more than 1 information class. Spectral vs. Information Classes: May take many spectral classes to describe one information class. One spectral class may represent more than 1 information class. Spectral Class Information Class Sunlit conifer Upland Conifer Hillside shadowed conifers Upland Deciduous Deciduous broadleaf Lowland Deciduous Spectral Classes: pixels of one land cover type tend to cluster together Veg 1 NIR Veg3 reflect ance Soil 3 Veg 2 Soil 2 Water 2 Soil 1 Water 1 Red reflectance Adapted from J.A. Richards, 1986 Spectral vs. Information Classes Veg 1 Soil Information class NIR Veg3 reflect ance Soil 3 Veg 2 Soil 2 Water 2 Soil 1 Water 1 Red reflectance Adapted from J.A. Richards, 1986 Spectral & information classes do not always have a 1-to-1 match Veg 1 NIR Veg3 reflect ance Veg 2 Water 2 Same spectral class may belong to more than one information class Developed 3 Soil 3 Developed 2 Soil 2 Developed 1 Soil 1 Water 1 Red reflectance Adapted from J.A. Richards, 1986 Classification Process • 1) Training/Clustering Stage - the process of defining criteria by which spectral patterns are recognized, developing a numerical description for each spectral class • 2) Classification Stage - each pixel in the image data set is categorized into the spectral class it most closely resembles based on a mathematical decision rule • 3) Output Stage - results are presented in a variety of forms (tables, graphics, etc.) Multispectral classification Multispectral image classification using spectral pattern recognition often relies on measuring the “likelihood” that a pixel belongs to one class vs. another. This likelihood generally relies on some measure of distance between a pixel and the various spectral classes clusters. For example, if a pixel is “closest” to Spectral Class 1 vs. Spectral Class2, then the pixel is classified into spectral Class 1. Spectral distance can be measured in several ways: - as simple euclidean distance in multispectral space - as a statistical distance or probability Spectral distance • Spectral distance - the Euclidean distance in n-dimensional spectral space • D = SQRT[(sum (dk - ek)2] where dk = BV of pixel d in band k where ek = BV of pixel e in band k • the equation is summed across k = 1 to n bands What is the spectral distance between Pixel A and Cluster 1? Pixel A Y 92, 153 Cluster 1 180, 85 X Spectral Distance example Distance between [x1,y1] & [x2, y2] [180, 85] & [92, 153] D = SQRT[(sum (dk - ek)2] D = SQRT[(180-92)2 + (85-153)2] = SQRT[(88)2 + (-68)2] = SQRT[7744 + 4624] = SQRT[12,368] = 111.2 Spectral Distance example Y 92, 153 Yd = 85-153 180, 85 Xd = 180 -92 X Supervised vs. Unsupervised Approaches • Supervised - image analyst "supervises" the selection of spectral classes that represent patterns or land cover features that the analyst can recognize Prior Decision • Unsupervised - statistical "clustering" algorithms used to select spectral classes inherent to the data, more computer-automated Posterior Decision Supervised vs. Unsupervised Supervised Prior Decision: from Information classes in the Image to Spectral Classes in Feature Space N I R Red Unsupervised Posterior Decision: from Spectral Classes in Feature Space to Information Classes in the Image Supervised Select Training fields Edit/evaluate signatures Classify image Evaluate classification vs. Unsupervised Run clustering algorithm Identify classes Edit/evaluate signatures Evaluate classification ISODATA (Iterative Self-Organizing Data Analysis Technique) Clustering Algorithm • • • • • • • • • User specified Input (as implemented in ERDAS) maximum number of clusters Initial allocation of cluster center locations maximum % of pixels whose class values are allowed to be unchanged between iterations. maximum number of iterations Other possible constraints (not implemented in ERDAS) minimum number of members in a cluster, if fall below threshold then that cluster eliminated maximum standard deviation: if the std dev exceeds the threshold then that cluster is split into two minimum distance between cluster means Initial Cluster Allocation • clusters allocated along the mean ndimensional vector • spaced according to std dev distance away from central mean N I R Red Algorithm Operation • each pixel is compared to each cluster mean and assigned to the cluster whose mean is closest in Euclidean distance ________________________________ \/(DNb1i-DNb1m)2 + ... + (DNbxi - DNbxm)2)) and a new cluster center is computed by averaging the locations of all the pixels assigned to that cluster. •ISODATA: multiple iterations from initial allocation to final assignment •The algorithm will stop either when the # iteration threshold is reached Or the max % of unchanged pixel threshold is reached Initial clusters NI R Final clusters NI R Red Red Adapted from Jensen 2nd ed, 1996 Example: ISODATA clustering Initial clusters: 1 (10,10), 2 (20,20) 3 (30,20) Unclassified Pixel (30,10) 1. Assigning unclassified pixels to cluster means Distance between Unclassified Pixel Cluster 1 Cluster 2 Cluster 3 Band 4 30-10 = 20 30-20 = 10 30-30 = 0 Band 5 10-10 = 0 10-20 = -10 10-20 = -10 Squared distance Sum Sqr Root Band 4 400 100 0 400 200 100 20 14 10 Band 5 0 100 100 Unclassified Pixel Assigned to Cluster 3 2. Calculating new cluster means - Cluster 1 & 2 unchanged - Cluster 3 migrates to Band 4mean, Band 5mean = 30, 15 Example of Naturally Clustered Data Green Vegetation NIR Senesced Vegetation Red Adapted from Swain Initial cluster centers N I R x After 1st iteration x Red After 2nd iteration x Red x Red x N I R x N I R Final cluster centers x N I R x Red Final Cluster Centers Green Vegetation X NIR X Senesced Vegetation Red Adapted from Swain N I R R e f l e c t a n c e Spectral Feature Space Grass Trees Impervious Surface & Bare Soil water Red Reflectance In spectral feature space, generally no distinct, isolated clusters, rather a continuous gradient. Classification can be thought of as trying to subdivide the feature space into appropriate spectral regions Algorithm Operation • The objective is to minimize the Sum of Squared Errors (SSE) across the entire set of clusters and the original pixel data • The Sum of Squared Errors (SSE): is the cumulative squared difference (i.e., spectral distance across all the various bands) of each pixel from its assigned cluster center • An optimal arrangement has been reached that minimizes the distance between every pixel and a cluster center (based on that number of clusters) HWK Example: SSE calculation Initial clusters (2,1) & (4,2) 1st iteration X Y DistA DistB SSE 1 2 1.41 3.00 2.0 2 3 2.00 2.24 4.0 2 4 3.00 2.83 8.0 3 4 3.16 2.24 5.0 4 3 2.83 1.00 1.0 4 4 3.60 2.00 4.0 4 6 5.38 4.00 16.0 5 7 6.71 5.10 26.0 6 5 3.60 13.0 5.66 New cluster centers (1.5, 2.5) (4, 4.6) S = 79 Post-clustering Assignment • The analyst must then assign each spectral cluster to an information class based on available ancillary information (e.g., field reference data, maps, aerial photos, analyst experience) Posterior Decision process • If one and only one information class can not be unequivocally assigned to a cluster then assign the cluster to a “mixed” class Post Clustering Assignment: what information class can be assigned to each spectral cluster? 71:grass 21:low intensity residential 33:transitional 31:Bare rock 41:decidous forest NI R 91:wetlands 42 evergreen forest 11:water 32: Quarries 84:fallow 22: high intensity residential 23: Commercial Red Adapted from Jensen 2nd ed, 1996 ISODATA Clustering: Pros • clustering not geographically biased to any particular portion of the image • highly successful at finding inherent spectral clusters • results similar to a minimum-distance-to-means classifier ISODATA Clustering: Cons • analyst doesn’t know a priori number of spectral classes • number of iterations needed, can be time consuming • does not account for pixel spatial homogeneity • Insensitive to variance/covariance Cluster-busting • technique to iteratively “bust up” spectrally “mixed” classes • separate “good” vs. “bad” classified pixels into a binary mask • mask out the “good” image, extract the “bad” image data and re-run the unsupervised process • re-evaluate new clusters, keep good, toss out “bad”, cluster bust again • create final cluster map by using a GIS overlay with a maximum dominate function Cluster-busting: in feature space N I R N I R Red Red Cluster-busting: in geographic space - separate “good” vs. “bad” classified pixels into a binary mask - mask out the “good” (green) image - extract the “bad”(red) image data - re-run the unsupervised process Cluster-busting - re-evaluate new clusters, keep good, toss out “bad”, cluster bust again (if needed) - create final cluster map by using a GIS overlay with a maximum dominate function Overlay Cluster busting Recode “good” class(es) = 0 “bad” class(es) > 1 Mask original image file Cluster busting New clusters = the holes Old clusters – “bad” = swiss cheese Overlay