CONTEXT

Contextual Classification


EnvironmentsPYTHON :: EASI :: MODELER
Batch ModeYes
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: References

Back to top

Description


Performs frequency-based contextual classification of multispectral imagery, using a gray-level reduced image and a set of training site bitmaps.
Back to top

Parameters


Name Type Length Value range
Input: Input raster channel * Raster port 1 - 1  
InputBitmap: Input training site bitmaps * Bitmap port 2 - 254 -254 -
Gray Level Value List Integer 0 - 254 -254 -
Pixel Window Size * Integer 1 - 1  
Output: Output classified channel * Raster port 1 - 1  
Report String 0 - 192 See parameter description

* Required parameter
Back to top

Parameter descriptions

Input: Input raster channel

Specifies the input channel that contains the gray-level vector-reduced image. The input channel must be 8-bit data. Any 16- and 32-bit data channels should be scaled to 8-bits using the SCALE function.

InputBitmap: Input training site bitmaps

Specifies two to 254 bitmap segments that contain the training sites for each class.

Duplicate bitmap segments are not allowed. At least two bitmap segments must be specified.

Gray Level Value List

Optionally specifies two to 254 values for output classes that correspond to each input training site bitmap (DBIB). Unless specified, the output classes are sequentially assigned values starting from 1 to the specified number of input bitmaps.

Up to 254 values can be handled, and up to 48 integer values may be specified.

Pixel Window Size

Specifies the window size to use when performing contextual classification on each pixel. The window size must be an odd integer between 3 and 21. In general, contextual classification performs better when you specify a larger window size, especially if the original input image contains complicated mixed classes (such as residential, commercial, or industrial areas). If the classes are uniform and spectrally pure, a smaller window size is sufficient.

Output: Output classified channel

Specifies the output channel to receive the classification results.

Report

Specifies where to direct the generated report.

Available options are:

Back to top

Details

CONTEXT performs the second of two steps in frequency-based contextual classification of multispectral imagery. It takes as input a gray-level vector-reduction image (DBIC) and a set of training site bitmap segments (DBIB), and creates a classification image (DBOC).

Each input bitmap can be assigned a unique output class value (VALU) for the classification image. The contextual classifier uses a specified window size (PWSIZE) around each pixel.

The pixel window size must be an odd integer that is between 3 and 21. The default size is 3, but should be larger for images with complex class patterns, such as in urban areas. You may need to run the contextual classifier with the same input data but different settings for PWSIZE until a desired output is produced.

CONTEXT cannot classify (PWSIZE-1)/2 pixels along the edges of the image. If the output window borders the edge of the image file, the output pixels along the edge are set to zero to indicate unclassified or unknown pixels. These edge pixels are otherwise unchanged.

The error patterns caused by the contextual classification algorithm are usually located systematically along the class boundaries. This lets you understand the quality of the thematic maps produced by this algorithm.

The maximum number of pixels allowed per line for the output window is 8,192.

Back to top

References

The CONTEXT function uses the algorithm described in the following paper:

Gong, Peng and Philip Howarth. "Frequency-Based Contextual Classification and Gray-Level Vector Reduction for Land-Use Identification", Photogrammetric Engineering & Remote Sensing, 58, no. 4 (April 1992): 423-437.

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.