Image Processing

Image Processing and Analysis

Creating a Multi-Band or Mosaic Image in ER Mapper

Frequently there is a need to construct a multi-band image from a series of individual layers of data. This is sometimes referred to as a layer stack. This issue often arises when obtaining images for processing in ERMapper. You may receive a series of binary band sequential or TIF images, one for each band of data. They will need to be assembled into a single file with multiple bands. This technique is also used to subset images on occasion.

This technique can also be used to create stacked images that include a DEM layer or a classification layer that can be added to your satellite image. You can add two 7 band satellite images, one for each of two seasons, to create a new 14 band image for advanced processing. This same technique can also be used to combine two adjacent scenes into a single mosaic image.

The first step to creating a multi-band image in ERMapper is to open the algorithm window and add a pseudo layer for each band of the output image that you desire. You will need to change the layer name in the left side of the window from the default name “Pseudo Layer” to a unique name for each layer that you want to create. You can change the name by selecting the layer with a single click and then single clicking in the name to permit editing. In this example we have labeled the first two layers Band 1 and Band 2. You also need to select the correct file name and/or band number in the right window. In the example below the file selected is “new_haven_tm_utm.ers”. You will need to change the band number to B3:Band3 after the layer name is changed to “Band 3”. You may want to save this as an algorithm so you can easily recreate these steps with another file in the future.

When all layers have been properly labeled and the correct data layers are selected for each band, save the file as an ERMapper Raster Dataset. Make sure you check the box “Delete Output Transforms”!

A few additional notes…

If you want to combine images from different seasons, you will need to use names that keep the layers separated. You should use names something like “Band 1 Spring” and “Band 1 Summer”. This will produce different layers for each season.

To create a single mosaic image from multiple images:

If you want to merge two or more adjacent scenes, use the same layer names for the same bands of each image. For example, use the layer name “Band 1” for the pseudo layers for band one of each image. They will be combined into a single “Band 1” on the output

It’s so simple…

Working with Multiple Transforms

Open the Algorithm window
1 Click the Edit Algorithm toolbar button.
ER Mapper opens the Algorithm window. You can now view the process stream diagram (which is needed for this exercise).

Apply a 99% autoclip transform to the data
1 Click the 99% Contrast enhancement button.
ER Mapper applies a 99% autoclip transform to the image.

Insert a second transform before the current one
1 From the Edit menu on the Transform dialog, select Insert new transform.
A second transform (and button) is added to the process stream diagram on the Algorithm
window (it is inserted before the previous one). Its contents, currently empty, are shown in the Transform dialog.

Delete the new transform from the process stream
1 From the Edit menu on the Transform dialog, select Delete this transform.
The current transform (the new one you inserted) is deleted from the process stream diagram.

Append a second transform after the current one
1 From the Edit menu, select Append new transform.

A second transform (and button) is added to the process stream diagram (it is appended after the
previous one).
The histogram shows the data range (0-255) after it has been passed through the 99% autoclip
transform preceding it.

Specify Gaussian equalization for the new transform
1 On the Transform dialog, click the Gaussian equalize button.
ER Mapper creates a Gaussian equalization transform line and updates the image. The resulting image is created by applying two transforms–a 99% autoclip followed by a Gaussian equalization of the autoclipped result. This is an example of enhancing an image by combining the characteristics of two different types of transforms.

Move to the previous transform and histogram
1 On the Transform dialog, click the Move to previous transform in layer button.
The contents of the Transform dialog box change to show the previous transform in the process
stream diagram (the one applying a 99% autoclip). Also note that the corresponding transform
button in the process stream diagram is now depressed.
Note that the Y axis limits are zero to 255. The transform rescales the original data range (22-254)
into the 0-255 range. The rescaled range is used as the input data range for the transform following
it.
2 Click the Move to next transform in layer button.
The contents of the Transform dialog change to show the next transform (the one applying a
Gaussian equalization).


Note that the Actual Input Limits are zero to 255. These were created by setting 0 and 255 as the
output (Y axis) data range for the previous transform.
Note: Depending on the types of raster layers in your algorithm, the Transform dialog
may display other buttons that allow you to move between transforms in those
layers (such as red, green, and blue).


3 Click Close on the Transform dialog to close it.

Adding Filters to Images

Open and display an existing algorithm
1 Click the Open button on the Standard toolbar.
An image window and the Open file chooser appear.
2 From the Directories menu, select the path ending with the text \examples.
3 Double-click on the directory named ‘Data_Types’.
4 In the directory ‘SPOT_Panchromatic’, load the algorithm ’Greyscale.alg’.
ER Mapper displays a SPOT Panchromatic satellite image of the San Diego, California area in greyscale.
5 Drag the image window by its lower-right corner to make it about 50% larger.
6 Right-click on the image and select Zoom to All Datasets from the Quick Zoom menu.
ER Mapper redraws the image to fill the larger window size.

Apply a low pass (smoothing) filter to the image
1 Click on the Edit Filter (Kernel) toolbar button on the main menu.
The Filter dialog box appears. This dialog allows you to load standard filters supplied with
ER Mapper, and create and save your own filters.
2 From the File menu, select Load….
The Load filter file chooser dialog box appears.
3 From the Directories menu, select the path ending with the text \kernel.
4 Double-click on the ‘filters_lowpass’ directory to open it.
5 Double-click on the filter ’avg3.ker’ to load it.

The filter settings are displayed in the dialog box fields. The array (or matrix) of nine weighting values defining the 3 by 3 filter appear in the central scroll window (the “filter matrix window”). The low pass filter creates a blurring or averaging effect. In general, low pass filters work by taking the average value of all pixels in the matrix and assigning it to the center pixel, thus smoothing out jumps or spikes in the data. Low pass filters can be useful for reducing periodic “salt and pepper” noise or speckling in an image to make it easier to interpret the major features. Tip: The filter array window contains editable fields, so you can easily experiment and create your own filters with custom weighting coefficients and parameters and save them for later use.

Delete the low pass filter from the process stream
1 From the Edit menu (on the Filter dialog), select Delete this filter.
The filter is deleted from the process stream and the image is rendered without the averaging filter,
so it appears as it did before.

Apply a high pass (sharpening) filter to the image
1 From the File menu (on the Filter dialog), select Load….
2 From the Directories menu, select the path ending with the text \kernel.
3 Double-click on the ‘filters_high_pass’ directory to open it.
4 Double-click on the filter ’Sharpen2.ker’ to load it.

ER Mapper processes the algorithm to now include your high pass filter. The filter settings are displayed in the dialog box fields. The array of nine weighting values defining the 3 by 3 filter appear in the filter matrix window. The Sharpen2 filter enhances high frequency detail. In general, high pass or sharpening filters tend to increase the local contrast around edge features in the image, so the image appears sharper or crisper. Features like major roads and borders between urban and vegetated areas are therefore
more clearly defined.

Delete the high pass filter from the process stream
1 From the Edit menu (on the Filter dialog), select Delete this filter.
The image is rendered without the sharpening filter, so it appears as it did before.

Apply a directional gradient edge detection filter
1 From the File menu (on the Filter dialog), select Load….
2 From the Directories menu, select the path ending with the text \kernel.
3 Double-click on the ‘filters_sunangle’ directory to open it.
4 Double-click on the filter ’North_West.ker’ to load it.

ER Mapper processes the algorithm to now include your edge detection filter. The filter settings are displayed in the dialog box fields. The North_West filter is a non-linear filter designed to isolate and “raise” edge features in an image trending in a northeast to southwest direction. The data range produced by this filter is different from the previous image, so you need to adjust the transform to improve the contrast.

Adjust the contrast of the filtered image
1 Click the Edit Transform Limits button on the Common Functions toolbar to open the Transform dialog box.
Note the Actual Input Limits are about -500 to +500. This is the new data range created by
applying the edge detection filter to the original SPOT Pan image.


2 On the Transform dialog, select Limits to Actual from the Limits menu.
The X axis limits change to match the Actual Input Limits.
The image contrast is enhanced and most pixels are assigned a mid-grey color in the greyscale
lookup table.
3 Click the Create autoclip transform button.

ER Mapper redisplays the image with enhanced contrast. Edge features such as roads and land/
water borders are highlighted in black and white, while features without sharp changes (such as
ocean) are shown in grey.

This filter highlights edge features in an image as if a sun were shining from the northwest (upperleft) of the image. Therefore, edge features facing northwest are highlighted in bright, while opposite (southeast) facing edge features are dark. Edge enhancement filters are often used in geological applications to highlight faults and lineaments occurring in a specific compass direction.

Note: As shown here, applying filters to your data often produces a different data range which initially creates a low contrast image. You will commonly need to adjust the transforms for each layer after applying a filter. (The first two filters you applied did not significantly change the original data range, so a contrast adjustment was not necessary in those cases.)


Apply a Northeast gradient edge detection filter

1 From the File menu (on the Filter dialog), select Load….
2 From the Directories menu, select the path ending with the text \kernel.
3 Double-click on the ‘filters_sunangle’ directory to open it.
4 Double-click on the filter ’North_East.ker’ to load it.
This time edge features facing northeast are highlighted in white (features trending in a northwest
to southeast direction). Since the data range produced by applying the North_East filter is similar
to that produced by the North_West filter, you do not need to adjust the contrast.
5 Click the Close button on the Filter and Transform dialogs to close them.

Creating a threshold formula

Enter a simple threshold formula
1 In the Generic formula window, edit the formula text to read:

if input1 > 100 then input1 else null


This formula tells ER Mapper “if the image value is greater than 100, then process it, else assign it a value of null.” (Any image pixel assigned a value of null is excluded from further processing and does not appear in the final image.)


2 Click the Apply changes button.
The formula syntax is approved, and ER Mapper translates the generic formula into a specific formula. Notice that band 1 of the image is substituted for both occurrences of “input1” in the generic formula window.
3 ER Mapper processes the algorithm, which now includes your threshold formula.
Areas of the image with data values greater than 100 are displayed in color, while data values 0-100 display with no color (they appear black).

Process the formula and see how it affects the data range
1 Click on the post-formula Edit Transform Limits button in the process stream diagram.
The Transform dialog box opens. Drag it to an open part of the screen.


Note that the Actual Input Data range is 101 to 255. This is expected since data values 0-100 are set to null (no value) by the formula and are thus excluded from further processing. The shape of the histogram also reflects the clipping of the data at the 100 level.


Substitute a variable for the value 100
1 In the Generic formula window, edit the formula text to substitute the word “variable1” for the value 100. Your formula should read:


if input1 > variable1 then input1 else null


Your formula now includes a variable that you can set in the Relations window.


2 Click the Apply changes button.
Two things change: the Variables button above the Relations window becomes active, and the value of “variable1” becomes zero in the Specific formula window.
3 Click the Variables button.
The Relations window shows that the value of “variable1” is set to zero.
4 Edit the value of “variable1” field to read 120 then press the Return or Enter key on your keyboard.
This time only areas with data values greater than 120 are processed.
5 Change the value of “variable1” to 80, press Return or Enter to view the new threshold image.

As you can see, using references to variables in your formula (instead of actual values) can speed
experimentation.

Tip: You can have several different variables in a formula, and name them nearly
anything (for example threshold, width, X, y, are all valid). Be sure the names do
not conflict with text strings ER Mapper uses for standard functions.

6 When finished, close the Transform, Formula Editor, and Algorithm dialog boxes by clicking Close on each one.

Creating and saving a formula
Open a template greyscale algorithm and load a new image
1 On the main menu, click the Open button.
2 From the Directories menu, select the path ending with \examples.
3 Double-click on the directory named ‘Miscellaneous’.
4 Double-click on the directory named ‘Templates’.
5 In the ‘Common’ directory, load the algorithm ‘Single_Band_Greyscale.alg.’
A Landsat satellite image of San Diego displays in greyscale. (You will use this algorithm as a template to display another image in greyscale.)
6 Click the Edit Algorithm toolbar button to open the Algorithm window.
7 In the process stream diagram on the Algorithm window, click on the Load Dataset button.
8 From the Directories menu, select the path ending with \examples.
9 Double-click on the directory named ‘Shared_Data’.
10 Load the image ‘LandsatTM.ers.’
Band 1 of a Landsat TM satellite image shows an area named Ebagoola in northeastern Australia displays. (You will adjust the image contrast to brighten it later.)

Enter a generic band ratio formula
1 Click on the Edit Formula button in the process stream diagram.
The Formula dialog box opens and shows the default formula “INPUT1.”
2 In the Generic formula window, edit the formula text to read:

input1 / input2


This formula tells ER Mapper to divide the image band assigned to input1 by the band assigned to input 2.
3 Click the Apply changes button.

When you enter a new multiple input formula, ER Mapper automatically assigns image band 1 to input 1, band 2 to input 2, and so on.


Assign image bands to create a vegetation index image
1 In the Relations window, select B4:0.83_um from the drop-down list next to “INPUT1,” and select B3:0.66_um from the “INPUT2” drop-down. The generic reference “input1” is now assigned image band 4, and “input2” is assigned to band 3. When used with Landsat TM images, the 4/3 band ratio is a simple vegetation index formula. The image initially appears black because of the small data range created by the band ratio formula.

Display the vegetation index image and adjust the contrast
1 Click the post-formula Edit Transform Limits button in the process diagram.
Note the Actual Input Limits created by the formula (about zero to 5).
2 On the Transform dialog, select Limits to Actual from the Limits menu.

Your enhanced vegetation index image shows vegetated areas (higher ratio values) in light grey, and non-vegetated areas in darker shades. This band combination takes advantage of high vegetation reflectance in TM band 4 (near infrared light) and low vegetation reflectance in band 3 (red light). This is a rather barren part of Australia, so vegetation (shown as light grey shades) occurs mainly in the stream beds as shown in the image.

Change the bands to create a clay minerals image
1 In the Relations window, select B5:1.65_um for “INPUT1” and select B7:2.215_um for “INPUT2.” Using the same Generic formula, you have now chosen the appropriate TM band ratio (5/7) to create a simple clay minerals image.
2 ER Mapper processes the algorithm, this time using bands 5 and 7.
3 On the Transform dialog, select Limits to Actual from the Limits menu.
4 On the Transform dialog, click the Create autoclip transform button.
Your contrast enhanced clay ratio image shows clay-rich rocks (higher ratio values) in light shades of grey, and clay-poor rocks in darker shades. This band combination takes advantage of strong absorption by clay minerals in TM band 7 and high reflectance in TM band 5.
5 Close the Transform dialog box by clicking Close.

Add a description and comments for your formula
1 In the Formula Editor dialog, edit the “Description” text field to read:
Landsat TM clay minerals ratio


2 Click the Comments… button.
The Formula comments dialog box appears.
3 Type some comments about your formula, such as:
4 Click the OK button to save your comments and close the dialog.

Save the clay minerals ratio formula to disk
1 From the File menu (on the Formula Editor), select Save As….
2 Go to the directory named ‘Miscellaneous\Tutorial’ and double click on it to open it.
3 Click to place the cursor in the Save As: text field, then type in a name for the formula file. Use your initials at the beginning of the file name, followed by the text ‘clay_ratio,’ and separate each word with an underscore (_). For example, if your initials are “RK,” type in the name:
RK_clay_ratio


4 Click the OK button to save your formula to a disk file.

Note: Since bands 5 and 7 of the image were chosen as inputs 1 and 2 when you saved the
formula, they would be assigned as the default bands if you load the formula in the
future. As shown, you can easily change the band assignments.

5 Click the Close button to close the Formula Editor dialog.

Creating a polygon mask formula
Note: This exercise references regions in the sample image which have already been defined using ER Mapper’s vector drawing tools. More information on defining regions is contained in the chapter on Supervised Classification later in this manual and in the chapters on Supervised and Unsupervise Classification in the

Load the SPOT Panchromatic greyscale algorithm
1 On the main menu, click the Open button.
2 From the Directories menu, select the path ending with \examples.
3 Double-click on the directory named ‘Data_Types’.
4 In the ‘Landsat_TM’ directory, load the algorithm ‘Greyscale.alg.’
A Landsat TM satellite image of San Diego displays in greyscale.
5 From the View menu (on the main menu), select Quick Zoom, then select Zoom In.
ER Mapper zooms in 50% on the center point of the image.
Enter a formula using the “inregion” function
1 In the Algorithms window, click the Edit Formula button.
2 In the Generic formula window, edit the formula text to read:
if inregion(region1) then input1 else null


This formula tells ER Mapper “if the area of the image is within the boundaries defined by
region1, then process it, else assign it null.”


3 Click the Apply changes button to verify the formula syntax.
The generic formula is converted to a specific formula. Also notice that the Regions button
above the Relation window is now active.

Assign the “region1” argument to a region name
1 Above the Relations window, click on the Regions button.

The contents of the Relations window change to show the REGION1 argument and its default assignment to a region named All (which is simply the extents of the entire image.)

2 From the REGION1 drop-down list, select Down_Town.

You have now selected the Down_Town region to be assigned to generic region1. (This region is simply a vector polygon previously drawn to define the boundaries of the San Diego downtown area in this image.)
Only the area inside the region named Down_Town is processed, and all other areas of the image are assigned null values (so they appear black). By using the inregion function in your formula, you have created a “mask” to process only data within a certain geographic part of the image.

Display a different region in the image
1 From the REGION1 drop-down list, select Airport.
You have now selected the Airport region to be assigned to generic region1. (Airport is a vector polygon previously drawn to define the boundaries of the San Diego Lindbergh Field airport near downtown.)
Only the area inside the region named Airport is processed, and all other areas of the image are assigned null values (so they appear black). By using the drop-down list, you can easily change this formula to process any region defined in an image.

Generating Principal Components

Load the Landsat TM greyscale algorithm
1 On the main menu, click the Open button.
2 From the Directories menu, select the path ending with \examples.
3 Double-click on the directory named ‘Data_Types’.
4 In the ‘Landsat_TM’ directory, load the algorithm ‘Greyscale.alg.’
A Landsat satellite image of San Diego displays in greyscale. You will add a formula to this
algorithm to perform Principal Components Analysis.

Load a formula to calculate Principal Component 1
1 In the Algorithm window, click the Open Formula editor button.

The Formula Editor dialog will open.
2 From the Principal Components menu (on the Formula Editor dialog), select
Landsat TM PC1. ER Mapper loads the following formula into the Generic formula
window:
SIGMA(I1..I6 | I? * PC_COV(I1..I6 | ,R1 I?, 1))
This formula tells ER Mapper to generate Principal Component 1 (PC 1) from Landsat TM bands
1-5 and 7. It uses some of the special functions and constructs ER Mapper provides, including the
“SIGMA” summation construct and the ““PC_COV” covariance principal component
(eigenvector) value.
Principal Components Analysis is a statistical from of data compression often used to compress
the information content of multiple image bands into just two or three “principal component”
images. In this case, you are generating the first principal component of TM bands 1-5 and 7 (band
6 is usually not used for PC calculations because it contains thermal information).

Adjust the contrast of the PC 1 image
1 Click the post-formula Transform button in the process diagram.
Note that the data range create by the PC1 formula is about 40 to 520.
2 On the Transform dialog, select Limits to Actual from the Limits menu.
3 Click the Create autoclip transform button.
The image is rendered with enhanced contrast. The first principal component usually contains
most of the overall scene brightness or albedo information, so it shows large scale terrain features
well.

Edit the formula to calculate Principal Component 2
1 In the Generic formula window, edit the formula to change the last value from 1 to 2 as
shown below:
This formula tells ER Mapper to generate Principal Component 2 (PC 2) from Landsat TM bands
1-5 and 7. (The I1..I6 part of the formula tells ER Mapper to include six inputs in the calculation
which are currently assigned to bands 1, 2, 3, 4, 5, and 7.)
2 Click the Apply changes button to verify the formula syntax.
3 On the Standard toolbar, click the 99% Contrast enhancement button.
SIGMA(I1..I6 | I? * PC_COV(I1..I6 | ,R1 ,I?, 2))

ER Mapper applies a 99% clip to the data limits created by the PC 2 formula to automatically
create a contrast enhanced image. The second principal component shows very different
information than PC 1. Note how vegetated areas appear very dark in the PC 2 image, and ocean
areas appear relatively light.

Tip: The 99% Contrast enhancement toolbar button is especially useful for
automatically contrast stretching images that produce narrow or negative data
ranges (such as ratios, PCs, and others).

Edit the formula to calculate PC1 of bands 1, 4 and 7
1 In the Generic formula window, edit the formula to change values as shown below:
These changes tell ER Mapper to generate Principal Component 1 from only three image bands
instead of six. (Next you will choose which three bands to use.)
2 Click the Apply changes button to verify the formula syntax.
3 In the Relations window, change the INPUT to image band assignments as follows:
INPUT1 = B1:0.485_um
INPUT2 = B4:0.83_um
INPUT3 = B7:2.215_um
This tells ER Mapper to use bands 1, 4 and 7 as inputs to the Principal Components formula.
4 Click the 99% Contrast enhancement on the Standard toolbar.
The image looks similar to the PC 1 image you created earlier, but is generated using only bands 1,
4 and 7 of the Landsat TM image.
This example creates a simple greyscale image, but you can easily use the same formulas in RGB
algorithms to create color composites of PC images.

Close all image windows and dialog boxes
1 Close all image windows using the window system controls:
• Select Close from the window control-menu.
2 Click Close on the Algorithm window to close it.

SIGMA(I1..I3 | I? * PC_COV(I1..I3 | ,R1 ,I?, 1)

These changes tell ER Mapper to generate Principal Component 1 from only three image bands
instead of six. (Next you will choose which three bands to use.)

2 Click the Apply changes button to verify the formula syntax.
3 In the Relations window, change the INPUT to image band assignments as follows:
INPUT1 = B1:0.485_um
INPUT2 = B4:0.83_um
INPUT3 = B7:2.215_um
This tells ER Mapper to use bands 1, 4 and 7 as inputs to the Principal Components formula.

4 Click the 99% Contrast enhancement on the Standard toolbar.
The image looks similar to the PC 1 image you created earlier, but is generated using only bands 1,
4 and 7 of the Landsat TM image.
This example creates a simple greyscale image, but you can easily use the same formulas in RGB
algorithms to create color composites of PC images.

Close all image windows and dialog boxes

1 Close all image windows using the window system controls:
• Select Close from the window control-menu.
2 Click Close on the Algorithm window to close it.

SUPERVISED CLASSIFICATION

Defining training regions
About regions: Regions are vector polygons that define an area of interest in an image. Regions
can be used to process or display parts of an image separately from others, mask out parts of an
image for mosaicing, define training sites as you will do here, and other purposes. The definition
of each region is stored in the header file for the raster image.
Create a practice image
1 Click the Edit Algorithm toolbar button.
An image window and the Algorithm window appear.
2 On the Algorithm window, click the Load Dataset button in the process
stream diagram to open the file chooser. The Raster Dataset dialog box which is the
file chooser appears.
3 From the Directories menu, select the path ending with the text \examples
4 In the directory ‘Shared_Data’, load the image named ‘Landsat_MSS_notwarped.ers.’
5 MSS band 1 (MSS1) will be loaded into the Pseudo Layer.
If the image is very dark, do not do anything about it at this stage.
6 On the Algorithm window click the duplicate button three times and duplicate the
Pseudo Layer with MSS1 three times. You have now 4 Pseudo Layers with MSS1
band.
7 Use the process stream diagram Band Chooser for each layer on the Algorithm
window to load MSS1 (B1:0.55_um) in the first Pseudo Layer, MSS2 (B2:0.65_um) in
the second Pseudo Layer, MSS3 (B3:0.75_um) in the third Pseudo Layer and MSS4
(B4:0.95_um) in the fourth Pseudo Layer.

By turning off three layers at a time, display each band individually.
9 Edit the band descriptions and type in for band 1 (B1:0.55_um), for band 2
(B2:0.65_um), for band 3 (B3:0.75_um) and for band 4 (B4:0.95_um).
10 Turn on all the four layers.
11 From the File menu on the main menu select Save As…. Select ER Mapper Raster
Dataset (.ers) as the file type and save it in the examples\Miscellaneous\Tutorial
directory as ‘Landsat_practice.ers’.
Tip: To maintain the original dynamic range of the image, select the delete output
transforms option when saving it.

Load the practice image and display it as a RGB composite
1 On the Algorithm window, click the Load Dataset button in the process
stream diagram to open the file chooser.
2 From the Directories menu, select the path ending with the text \examples.
3 Open the ‘Miscellaneous’ directory.
4 In the directory ‘tutorial,’ double-click on the image named ‘Landsat_practice.ers’.
5 On the main menu click on the Image Display and Mosaicing Wizard
button.
The Image Display and Mosaicing Wizard dialog box opens.
6 Select Change display in this window, and click on the Next> button.
7 Select Red Green Blue, and click on the Next> button.
A status window will display the progress as the ‘Landsat_practice’ image is displayed as RGB
composite.
8 Click on the Finish button to close the Image Wizard.
9 Drag the image window by the lower-right corner to make it about 50% larger.
10 Right-click on the image and select Zoom to All Datasets from the Quick Zoom
menu.
ER Mapper will redraw the image to fit into the enlarged window.

You will next draw polygons to define several feature classes in the image.

Add a vector layer for region definition to your algorithm
1 From the Edit menu, select Edit/Create Regions….
The New Map Composition dialog box opens.
2 In the New Map Composition dialog, notice that the Raster Region option is
selected.
Note: The Raster Region option tells ER Mapper that the annotation layer will be used
to create regions for a raster image (for use in training site selection in this case).

3 Click OK on the New Map Composition dialog box.
4 ER Mapper opens the Tools palette dialog box containing your vector annotation
tools. Also notice that a new vector layer titled ‘Region Layer’ has been added to the
layer list in the Algorithm window.
5 From the File menu (on the main menu), select Save As… to save the algorithm under
your own name with the new page extents information.
6 In the Files of Type: field, select ’ER Mapper Algorithm (.alg)’.
7 From the Directories menu, select the path ending with the text \examples.
8 Double-click on the directory ‘Miscellaneous’ to select it.
9 Double-click on the directory ‘Tutorial’ to open it.
10 In the Save As: text field, type a name using your initials at the beginning, followed
by the text ‘land_use_regions.’ Separate each word with an underscore (_). For
example, if your initials are “KA,” type in the name:
KA_land_use_regions
11 Click OK or Save to save the algorithm, which now includes your Page Setup
parameters.
12 Click Close on the Algorithm window to close it.

Open the Geoposition dialog box
1 From the View menu, select Geoposition….
The Algorithm Geoposition Extents dialog box opens. Move it to the right side of the screen.
2 Select the Zoom option to display buttons for zooming and panning.
You will use these options to help zoom in and out of areas as you define your training region
polygons.

Define training regions on the image
1 Use the following diagram as a guide to help locate training regions in the image. You
are asked to define these regions in the next steps.

Define a region to represent ocean areas
1 On the Tools palette dialog, click the ZoomBox Tool button.
2 Zoom in on the lower-left quarter of the image.
The large portion of dark blue area is ocean in this scene.
3 On the Tools palette dialog, click on the Polygon button

4 Point to an area of ocean and draw a polygon by clicking once at each point, then
double-clicking to close the polygon. (Make your polygon fairly large to get a good
sample.)
The polygon is selected by default when you close it. Since it is selected, you can now add a color
and text attribute to give the polygon a name.
5 On the Tools dialog, double-click the Polygon button to open the Line Style
dialog box.
6 On the Tools dialog, click the Display/Edit Object Attributes button to open
the Map Composition Attribute dialog box
Position the Line Style and Map Composition Attribute dialogs in a convenient position on
the screen. You will leave these dialogs open while you define regions so you can assign a color
and name to each region as you go. (The colors you assign becomes the default class colors in the
output classified image.)
7 In the Line Style dialog, click the Set Color button, choose a blue color, and click
OK to close the color chooser.
8 In the Map Composition Attribute dialog, enter the text Ocean in the text field at
the bottom, then click the Apply button.
The text “Ocean” is now defined as a the name or text attribute of the polygon.
You have now defined a training region representing ocean areas in the image. When you calculate
statistics for this image later, the statistics for pixels inside this region will be used as a “signature”
to classify other areas of ocean in the image.

Define a region to represent natural vegetation
1 On the Geoposition dialog, click All Datasets to zoom back out.
2 On the Tools palette dialog, click the ZoomBox Tool button.
3 Zoom in on the upper-right quarter of the image.
The dark brown areas at the top of the image are natural vegetation.
4 Click on the Polygon button.
5 Draw a polygon to define a large area of natural vegetation (click once at each point,
then double-click to close the polygon).
The polygon becomes selected when you close it.
6 In the Line Style dialog, click Set Color, choose a dark green color, and click OK to
close the color chooser.

7 In the Map Composition Attribute dialog, enter the text Natural vegetation
in the text field at the bottom, then click the Apply button.
You have now defined a training region representing natural vegetation.

Define a region to represent grass and park areas
1 On the Geoposition dialog, click All Datasets to zoom back out.
2 On the Tools palette dialog, click the ZoomBox Tool button.
3 Zoom in on one of the small, bright red areas (there is one in the river valley running
east to west). Zoom in far enough so the bright red area fills most of the image window.
These are parks, golf courses, or other irrigated artificial vegetation.
4 Click on the Polygon button and digitize a polygon around the border of the
bright red park area.
5 In the Line Style dialog, click Set Color, choose a bright green color, and click OK
to close the color chooser.
6 In the Object Attribute dialog, enter the text Grass and parks in the text field
at the bottom, then click the Apply button.
You have now defined a training region representing grass and park areas.

Define a region to represent urban areas
1 On the Geoposition dialog, click All Datasets to zoom back out.
2 On the Tools palette dialog, click the ZoomBox Tool button.
3 Zoom in on the grey areas near the center of the image.
These are developed urban areas.
4 Click on the Polygon button and digitize a polygon around the border of the grey
urban area (do not include red vegetated areas on the edges).
5 In the Line Style dialog, click Set Color, choose a grey color, and click OK to close
the color chooser.
6 In the Map Composition Attribute dialog, enter the text Urban areas in the
text field at the bottom, then click the Apply button.
You have now defined a training region representing urban areas.

Define a region to represent residential areas
1 On the Geoposition dialog, click All Datasets to zoom back out.
2 On the Tools palette dialog, click the ZoomBox Tool button.
3 Zoom in on one of the pink area in the northern part of the peninsula as shown in the
previous diagram.
This area is primarily residential housing, so it has both buildings (houses) and vegetated areas
(grass and trees).
4 Click on the Polygon button and digitize a polygon around the pink areas
described.
5 In the Line Style dialog, click Set Color, choose a pink color, and click OK to close
the color chooser.
6 In the Map Composition Attribute dialog, enter the text Residential areas
in the text field at the bottom, then click the Apply button.

Define a region to represent barren land areas
1 On the Geoposition dialog, click All Datasets to zoom back out.
2 On the Tools palette dialog, click the ZoomBox Tool button.
3 Zoom in on the lower-right quarter of the image.
There are several areas of barren land here that appear white on the image (since they have high
reflectance in all three MSS bands).
4 Click on the Polygon button and digitize a polygon around the border of one of
the barren white areas (do not include other areas on the edges).
5 In the Line Style dialog, click Set Color, choose a light brown color, and click OK
to close the color chooser.
6 In the Map Composition Attribute dialog, enter the text Barren land/cement
in the text field at the bottom, then click the Apply button.
You have now defined training regions representing ocean, natural vegetation, grass/parks, urban
and residential areas, and barren land areas.
Tip: To define multiple polygons to be used as a single statistical region, assign all the
polygons the same text attribute name. ER Mapper combines statistics for any
regions with the same name automatically.

Save the regions to the Landsat MSS practice image
1 On the Tools palette dialog, click the Save As button.
The Map Composition Save As chooser dialog appears.
2 From the Directories menu, select the path ending with the text \examples.
3 Double-click on the directory ‘Miscellaneous’ to open it.
4 Double-click on the directory ‘Tutorial’ to open it.
5 Click on the image named ‘Landsat_practice’ to select it, then click OK.
6 When asked to confirm the overwrite, click OK to proceed. After the next dialog
indicates all your new regions were added, click Close to close it.
The regions definitions and names are saved to the header file of the ‘Landsat_practice’ image.
You can now calculate statistics for the pixels in each region.
7 Click Close on the Tools palette and Geoposition dialogs to close them.

Calculate statistics for the new regions
1 From the Process menu, select the Calculate Statistics.
The Calculate Statistics dialog box appears.
The ‘Landsat_practice’ image should be chosen by default because it is the image used in the
current algorithm. (If it is not chosen, load it from the ‘tutorial’ directory).
2 Set the Subsampling Interval to 1.
3 Select the Force Recalculate stats option (to calculate statistics again in case they
have previously been calculated).
4 Click OK to start the statistics calculation.
5 When the calculation is finished, click OK in the dialog indicating successful
completion, then close the other statistics dialogs with Close or Cancel.

View training statistics
View tabular statistics for the training regions
1 From the View menu, select the Statistics, then select Show Statistics.

The Statistics Report dialog box appears. The ‘Landsat_practice’ image should be selected by
default. You can choose to view statistics for selected regions or bands in the image, or for all
regions and bands.
2 Click OK to display statistics for the all the regions you defined.
The display image Statistics dialog opens showing statistics for all your regions in all four Landsat
MSS image bands.
3 Scroll through the list to view statistics for your training regions (make the dialog
larger if needed).
(The last region listed named ‘All’ is the entire image. This region is present in every image
header file.)
4 When finished viewing statistics, click Cancel on the Statistics Report dialog to
close both dialogs.

Add a Classification layer and load the Landsat image
1 Click the Edit Algorithm toolbar button to open the Algorithm window.
2 Click on the ‘Region Layer’ layer to select it, then click Delete to delete the layer.
(You no longer need it for this exercise.)
3 From the Edit/Add Raster Layer menu, select Classification.
A Classification layer is added to the algorithm layer list.
4 In the process diagram, click the Edit Layer Color button.
5 Choose a bright yellow color, then click OK to close the color chooser.
6 In the process diagram, click the Load Dataset button.
7 From the Directories menu, select the path ending with the text \examples
8 Double-click on the ‘Miscellaneous’ directory to open it.
9 Double-click on the ‘Tutorial’ directory to open it.
10 Double-click on the image ‘Landsat_practice’ to load it.
You can now use the Classification layer to display a training region in yellow on the image and
show its histogram in any band.

Enter a formula to display a region
1 Click the Edit Formula button in the process diagram to open the Formula
Editor dialog.
2 In the Generic formula window, edit the formula text to read:

if inregion(region1) then input1 else null

This formula tells ER Mapper to process and display the data inside the region chosen as region 1
in yellow on the image.

3 Click the Apply changes button.
Notice that the Inputs and Regions buttons above the Relations window are now active. Image
band 1 is assigned to generic input1 by default.
4 Click the Regions button, select Grass/Parks from the drop-down list next to
‘REGION1.’
Your Grass/Parks region is displayed in yellow over the RGB image.

View the histograms for the Grass/Parks region
1 Click on the post-formula Edit Transform Limits button to open the
Transform dialog box. Move it so it does not overlap with the image window or
Formula dialog.
2 From the Limits menu, select Limits to Actual.
The histogram for the pixels in band 1 of the training region ‘Grass/Parks’ appears in the
histogram window.
3 In the Formula dialog, click the Inputs button, then select B3:0.75_um from the
‘INPUT1’ drop-down list.
4 From the Limits menu, select Limits to Actual.

Note: Since the data range is different for each band and region, you need to use Limits
to Actual each time you change the band or region. Otherwise the new histogram
may not fully display due to the limits set for the previous one.
The histogram for the pixels in band 3 of the training region ‘Grass/Parks’ appears in the
histogram window. By changing the assignments in the Relations window, you can view a
histogram for any band and region combination in the image. The histogram provides important
information about the distribution and range of data values in your training regions.

5 If desired, view histograms for other region and/or band combinations using the steps
listed previously.
6 When finished, click Close on the Formula Editor dialog, and Close on the
Algorithm window.

View a scattergram for the MSS image
1 From the View menu, select Scattergrams….

The Scattergram dialog box and New Map Composition dialog boxes open. Notice that the
New Map Composition dialog already has Raster Regions selected and the name of your
image entered.
2 Click OK on the New Map Composition dialog.
The annotation Tools dialog opens and the Scattergram dialog automatically references the
image in the active image window (‘Landsat_practice’). Notice also that your region polygons are
shown on the image in their assigned color.

Set the scattergram bands and limits
1 In the Scattergram dialog, click the Setup… button.
2 In the Scattergram Setup dialog, select band 2 for the X Axis field, and band 4
for the Y Axis field.
3 Click the Limits to Actual button to set the X and Y axis limits to the actual data
ranges of bands 2 and 4.
The scattergram for image bands 2 (red light) and 4 (near infrared light) is redisplayed to fill the
window. The wide dispersion of points in the scattergram indicates that the information in these
two bands is not strongly correlated.

Display mean and probability ellipses for training regions
1 In the Scattergram Setup dialog, turn on the From current selection option.
This tells ER Mapper that you want to display the mean value and 95% probability ellipse for the
currently selected region polygons in the image.
2 On the Tools dialog, click the Select and Edit Points Mode button.
3 In the image, select the grey polygon defining your ‘urban’ class training region (click
on a line segment).
A grey ellipse appears over the scattergram showing the 95% probability threshold and mean
value (the ellipse center point) for the ‘urban’ class in bands 2 and 4. (The ellipse extents represent
the probability that an unknown pixel is a member of that class at the 95% confidence level.)
4 In the image, select the green polygon defining your ‘grass’ class training region.
A green ellipse appears on the scattergram. As indicated, green vegetation shows a strong response
in MSS band 4 (near infrared), but low response in band 2.
5 Hold down the Shift key, then click on the dark green ‘natural vegetation’ polygon in
the image.
Ellipses for both the ‘grass’ and ‘natural vegetation’ regions appear on the scattergram, so you can
easily compare them. Comparing region means and ellipses in an excellent way to evaluate the
separability of your class signatures.

Tip: To select multiple polygons, hold down the Shift key while clicking.

Close the scattergram dialogs
1 Click Close on the annotation Tools dialog to close it.
2 Click Cancel on the Scattergram Setup dialog to close it, then click Cancel to
close the Scattergram dialog.

Classifying the image
Open the Supervised Classification dialog box
1 From the Process menu, select Classification, then select Supervised
Classification.
The Supervised Classification dialog box opens. The ‘Landsat_practice’ image is already
chosen as the default input image.The dialog also lets you choose which bands of the image to use
for the classification, and the type of classification (or decision rule) to use.
2 Click the Output Dataset chooser button.
3 From the Directories menu, select the path ending with the text \examples.
4 Double-click on the ‘Miscellaneous’ directory to open it.

5 Double-click on the ‘Tutorial’ directory to open it.
6 In the Save As field, type a name using your initials at the beginning followed by the
text ‘max_like_class,’ and separate each word with an underscore (_). For example, if
your initials are “KA,” type in the name:
KA_max_like_class
7 Click OK or Save to validate the name and close the file chooser dialog.

Setup the classification type and parameters
1 Click the Classification Type drop-down to see the list.
ER Mapper provides Maximum Likelihood Enhanced, Minimum Distance, Minimum Distance
with a standard deviation, Parallelopiped, and Mahalanobis classifiers.
2 From the Classification Type/Maximum Likelihood Enhanced menu, select
Maximum Likelihood Standard.
3 Click the Setup button.
The Supervised Classification Setup dialog box opens. This dialog allows you to setup the
options used for the classification, including which training regions to use (from this or other
images), assigning class probabilities, and other options. By default, the five regions in your
practice image are displayed.
4 Click the Close button to close the Supervised Classification Setup dialog box.

Classify the image
1 Click the OK button to start the classification.
2 When asked to confirm the successful completion, click OK. Then click Close and
Cancel on the other two dialogs to close them.
The output of the classification is a single band image. Each pixel in the image is has a value
ranging from 1 to 6 (the number of training regions you specified).

Open a second window and template algorithm

1 Click the New toolbar button. An image window appears.
2 Drag the new window down below the one displaying the Landsat image.
3 Click the Open toolbar button.
4 From the Directories menu, select the path ending with the text \examples.

5 In the directory ‘Miscellaneous\Templates\Common’, load the algorithm named
‘Classified_data.alg.’
A classified image of San Diego displays. This is a template algorithm you will use to display your
classified image.

Load the classified image you created earlier
1 Click the Edit Algorithm toolbar button.
Notice that this algorithm has one layer of the type Class Display. The Class Display layer is
designed to display images created with ER Mapper’s classification functions.
2 In the process diagram, click the Load Dataset button.
3 From the Directories menu, select the path ending with the text \examples.
4 Double-click on the ‘Miscellaneous’ directory to open it.
5 In the directory ‘Tutorial,’ double-click on the image ‘max_like_class’ you created
earlier to load it.
Each pixel in the original Landsat image is assigned to one of the six training classes you defined
earlier. The class colors are those you defined for the training region polygons.
6 From the Edit menu (on the main menu), select Edit Class/Region Color and
Name.
The Edit Class/Region Details dialog opens showing the name and color assigned to each class. If
desired, you could change them here.
7 Click Cancel on the Edit Class/Region Details dialog to close it.

Close all image windows and dialog boxes
1 Click Close on the Algorithm window to close it.
2 Close all image windows using the window system controls:
• Select Close from the window control-menu.
3 Click Close on the Algorithm window to close it.
Only the ER Mapper main menu should be open on the screen.

Generating Confusion Matrices

Overview
The ER Mapper Confusion Matrix facility tests a classified image against a reference dataset, and
then generates the following types of matrices:
• Row counts
• User’s accuracy
• Producer’s accuracy
It also displays the Overall accuracy and the Kappa statistics.

Obviously, the reference data is crucial in creating the matrices. One method of obtaining this
reference data is to establish sample “ground truth” points on the image, and then to physically go
to where the points are located in the field to verify the actual class to which they belong. The
information from these points can then be collated into an ASCII XYZ text file in which each line
represents a single sample point. The information for each point includes the X and Y coordinates
of the location of the point, and the number and label of the class to which the point belongs. This
file can be imported as an ER Mapper vector dataset via the Utilities / Import Vector and
GISformats / ASCII Points with Attributes menu option. You can then enter this vector file
as the reference dataset to generate confusion matrices. This reference should be very accurate
because the sample points been physically verified in the field. The accuracy of the confusion
matrices depends on the number of sample points and how they are distributed over the classes.
Another source of reference data is the actual training regions that were used to classify the image
under test. This will provide you with a very good indication of how accurate the classification
was, and the effectiveness of the training regions. The ER Mapper Confusion Matrix facility
accepts only classified images or vector images with points and attributes as reference datasets.
Training regions are neither of these, so it is necessary to create a classified image that includes
only the areas within the training regions. This exercise describes how this is done.

Load and display the practice image
1 On the ER Mapper Standard Toolbar, click the Open button to open the file
chooser.

2 From the Directories menu, select the path ending with the text \examples.

3 Open the ‘Miscellaneous’ directory.
4 In the directory ‘tutorial,’ double-click on the image named ‘Landsat_practice.ers’.
The original Landsat MSS practice image will be displayed with Bands 1, 2 and 3 in Blue, Green
and Red bands respectively.
5 If necessary, you can click on the 99% Contrast Enhancement button to make
the image visible.
6 Click the Edit Algorithm toolbar button to open the Algorithm window.

Add a formula to each layer
We will add a formula to each layer that excludes those parts of the image that do not fall within
the training regions that were previously added to this image.
1 On the Algorithm window, click on the Red layer to highlight it.
2 Click the Edit Formula button in the process diagram to open the Formula
Editor dialog.
3 In the Generic formula window, edit the formula text to read:


if inregion(region1) or inregion(region2) or
inregion(region3) or inregion(region4) or
inregion(region5) or inregion(region6) then INPUT1 else
null

This formula tells ER Mapper to process and display the image data inside the regions. Areas that
fall outside the regions are not displayed.


4 Click the Apply changes button.
Notice that the Inputs and Regions buttons above the Relations window are now active. Image
band 3 is assigned to generic INPUT1 by default.
5 Click the Regions button, select different Region names from the drop-down list next
to ‘REGION1’, ‘REGION2’ etc.
The formula will cause ER Mapper to display in the Red layer only the parts of Band 3 that fall
within the regions.
6 On the Formula Editor dialog, click on the Green layer button to edit the formula
in the Green Layer.
7 In the Generic formula window, edit the formula text to read:
if inregion(region1) or inregion(region2) or inregion(region3) or inregion(region4) ori nregion(region5) or inregion(region6) then INPUT1 else
null
This formula tells ER Mapper to process and display the image data inside the regions.
8 Click the Apply changes button.
Notice that the Inputs and Regions buttons above the Relations window are now active. Image
band 2 is assigned to generic INPUT1 by default.
9 Click the Regions button, select a different Region names from the drop-down list
next to ‘REGION1’, ‘REGION2’ etc.
The formula will cause ER Mapper to display in the Green layer only the parts of Band 2 that fall
within the regions.
10 On Formula Editor dialog, click on the Blue layer button to edit the formula in the
Green Layer.
11 In the Generic formula window, edit the formula text to read:


if inregion(region1) or inregion(region2) or
inregion(region3) or inregion(region4) or
inregion(region5) or inregion(region6) then INPUT1 else
null

This formula tells ER Mapper to process and display the image data inside the regions.
12 Click the Apply changes button.
Notice that the Inputs and Regions buttons above the Relations window are now active. Image
band 1 is assigned to generic INPUT1 by default.
13 Click the Regions button, select a different Region names from the drop-down list
next to ‘REGION1’, ‘REGION2’ etc.
The formula will cause ER Mapper to display in the Blue layer only the parts of Band 2 that fall
within the regions.
14 Close the Formula Editor by clicking on the Close button.

Save as a Virtual Dataset
We now save the algorithm as a virtual dataset, so that it can be used to create a classified image.
1 On the Standard toolbar, click on the Save As button.
2 In the Files of Type: field, select ’ER Mapper Virtual Dataset (.ers)’.
3 From the Directories menu, select the path ending with the text \examples.
4 Double-click on the directory ‘Miscellaneous’ to select it.
5 Double-click on the directory ‘Tutorial’ to open it.

6 In the Save As: text field, type a name using your initials at the beginning, followed
by the text ‘land_use_region_vds.’ Separate each word with an underscore (_). For
example, if your initials are “KA,” type in the name:
KA_land_use_regions_vds
7 Click OK or Save to save the virtual dataset.
8 Answer Yes to the “Delete final transforms for virtual dataset?” query.

Add the Region layer to the virtual dataset
We now need to add the region layer from the ‘Landsat_practice.ers’ dataset to the newly created
virtual dataset.
1 On the Algorithm window, select Edit / Add Vector Layer / Region Layer.
This will add a new Region Layer to the algorithm.
2 In the Region layer process diagram, click the Load Dataset button.
3 From the Directories menu, select the path ending with the text \examples.
4 Double-click on the ‘Miscellaneous’ directory to open it.
5 In the directory ‘Tutorial,’ double-click on the image ‘Landsat_practice’ to load it.
The Regions will now be displayed over the image. The areas of the image displayed should be
bounded by the Region polygons.
6 In the process diagram, click the Annotate Vector Layer button to open the
Tools dialog.
7 On the Tools dialog, click on the Save As button.
This will open the Map Composition Save As dialog.
8 In the Save As box, select Raster Region.
9 Click on the file chooser button in the Save To File: field.
10 From the Directories menu, select the path ending with the text \examples.
11 Double-click on the directory ‘Miscellaneous’ to select it.
12 Double-click on the directory ‘Tutorial’ to open it.
13 Select the name of the virtual dataset you created; e.g. ‘KA_land_use_regions_vds’
and click OK.
14 Click OK on the Map Composition Save As dialog to save the region layer to the
Virtual Dataset.
15 Answer Yes to overwriting the file.

The ER Mapper Message Window will indicate that it is adding new regions to the virtual dataset.

Close all image windows and dialog boxes
1 Click Close on the Message Window to close it
2 Click Close on the Tools dialog to close it.
3 Click Close on the Algorithm window to close it.
4 Close all image windows using the window system controls:

Open the Supervised Classification dialog box
1 From the Process menu, select Classification, then select Supervised
Classification.
The Supervised Classification dialog box opens.
2 Click the Input Dataset chooser button.
3 From the Directories menu, select the path ending with the text \examples.
4 Double-click on the ‘Miscellaneous’ directory to open it.
5 Double-click on the ‘Tutorial’ directory to open it.
6 Double-click on the name of the virtual dataset you created; e.g.
‘KA_land_use_regions_vds’.
7 Click the Output Dataset chooser button.
8 From the Directories menu, select the path ending with the text \examples.
9 Double-click on the ‘Miscellaneous’ directory to open it.
10 Double-click on the ‘Tutorial’ directory to open it.
11 In the Save As field, type a name using your initials at the beginning followed by the
text ‘land_use_regions_vds_class,’ and separate each word with an underscore (_). For
example, if your initials are “KA”, type in the name:
KA_land_use_regions_vds_class
12 Click OK or Save to validate the name and close the file chooser dialog.
13 Click the Classification Type drop-down to see the list.
14 From the Classification Type/Maximum Likelihood Enhanced menu, select
Maximum Likelihood Standard.
15 Click the OK button to start the classification.
16 When asked to confirm the successful completion, click OK. Then click Close and
Cancel on the other two dialogs to close them.

The output of the classification is a single band image of the training regions. Each pixel in the
image has a value ranging from 1 to 6 (the number of training regions you specified).

Generate Confusion Matrices
Here we will use the newly classified image as a reference to test the previously classified image
Every cell in the reference image becomes a sample point to test the classified image.
1 In the ER Mapper View menu, highlight Statistics, and then click on Confusion
Matrix… to select it.
The Confusion Matrix Setup dialog box will open.
2 In the Matrix Type: field, select ‘Row Counts’
3 Click on the Reference Dataset file chooser button.
4 From the Directories menu, select the path ending with the text \examples.
5 Double-click on the ‘Miscellaneous’ directory to open it.
6 Double-click on the ‘Tutorial’ directory to open it.
7 Double-click on the name of the classified dataset you created; e.g.
‘KA_land_use_regions_vds_class’.
8 Click on the Classified Dataset file chooser button.
9 From the Directories menu, select the path ending with the text \examples.
10 Double-click on the ‘Miscellaneous’ directory to open it.
11 Double-click on the ‘Tutorial’ directory to open it.
12 Double-click on the name of the classified dataset you originally created; e.g.
‘KA_max_like_class’.
13 Click OK to generate the matrix.
The Confusion Matrix Display window will display a matrix where the rows show how the
image under test has classified the areas within the regions, and the columns show how the
reference dataset has classified the same areas.
Depending on how your PC is set up, the display might not be easy to see. You can save it as a text
file to view with a text editor.
14 Click on the Print/Save… button to open the Print dialog.
15 On the Print dialog, select File as the Destination, and Report for the Format.
16 Click on the file chooser button and select a suitable file name for the text file.
17 Click OK to save the text file.
18 Open the text file in a text editor. You may have to do some editing to make it clearer.

An example matrix display (after editing) is shown below:
Raw Count Confusion matrix for:
Reference Dataset – KA_land_use_regions_vds_class.ers
Classified Dataset – KA_max_like_class.ers
Overall Accuracy: 99.287% from 20618 observations
Kappa statistic: 0.966

From the above, we can see that the reference dataset provided 20,618 sample points (cells). Of
these 99.287% were classified correctly in the classified image. The Kappa statistic of 0.966
indicates that the classification is 96.6% better than that expected if we had randomly assigned a
class to each image pixel in the classified image.
The ‘Barren land’ classification appears to be accurate because, of the 77 points on the training
regions, all were classified correctly in the classified image. The training region for ‘Natural
vegetation’ was somewhat larger, providing 1253 sample points. Of these, the classified image
classified 15 as ‘Residential areas’ and 52 as ‘Ocean’.

19 On the Confusion Matrix Setup dialog box select User’s Accuracy as the Matrix
Type, and click OK.

The Confusion Matrix Display window will display a matrix showing the User’s Accuracy in
classification. This is the percentage of sample points that the classified image predicts to be in
particular class with which the reference data concurs.
Depending on how your PC is set up, the display might not be easy to see. You can save it as a text
file to view with a text editor.

20 Click on the Print/Save… button to open the Print dialog.
21 On the Print dialog, select File as the Destination, and Report for the Format.

22 Click on the file chooser button and select a suitable file name for the text file.23 Click OK to save the text file.
24 Open the text file in a text editor. You may have to do some editing to make it clearer.

An example matrix display (after editing) is shown below:
Raw Count Confusion matrix for:
Reference Dataset – KA_land_use_regions_vds_class.ers
Classified Dataset – KA_max_like_class.ers
Overall Accuracy: 99.287% from 20618 observations
Kappa statistic: 0.966

From the above, we can see that ‘Barren land’ had 100% User’s accuracy value, indicating that all
the sample points were classified correctly.

25 On the Confusion Matrix Setup dialog box select Producer’s Accuracy as the
Matrix Type, and click OK.

The Confusion Matrix Display window will display a matrix showing the Producer’s Accuracy
in classification. This is the percentage of sample points in a particular class in the reference data,
that were correct in the classified image.
Depending on how your PC is set up, the display might not be easy to see. You can save it as a text
file to view with a text editor.

26 Click on the Print/Save… button to open the Print dialog.
27 On the Print dialog, select File as the Destination, and Report for the Format.
28 Click on the file chooser button and select a suitable file name for the text file.
29 Click OK to save the text file.
30 Open the text file in a text editor. You may have to do some editing to make it clearer.

An example matrix display (after editing) is shown below:
Raw Count Confusion matrix for:
Reference Dataset – KA_land_use_regions_vds_class.ers
Classified Dataset – KA_max_like_class.ers
Overall Accuracy: 99.287% from 20618 observations
Kappa statistic: 0.966

From the above, we can see that ‘Ocean’ had 99.754% Producer’s accuracy value, indicating that
not all the sample points in the reference were classified correctly.

Close all windows and dialog boxes
1 Click Cancel on the Confusion Matrix display window to close it.
2 Click Cancel on the Confusion Matrix Setup dialog to close it.

4 responses

5 02 2009
Mujahid

Wew.. Thanks for that!! My only 1 question: “how do you learn these???”

6 02 2009
Fatwa

“How do you learn these???” …

Just learn my bro…:)

13 03 2009
MasBas

Mas Fatwa, kalau ndak salah, yang di atas itu hasil dari ‘copy paste’ tutorial ermapper. Koreksi saya kalau salah.
Bisa minta tolong kasih tahu saya cara mengeliminasi awan dan bayangannya secara otomatis?
Jazaakallahu khairan

20 04 2009
Fatwa

iya bener mas…maklum, aku masi perlu buanyak belajar, sorry, I have taken few weeks for reply..

Leave a comment