| Environments | PYTHON :: EASI :: MODELER |
| Quick links | Description :: Parameters :: Parameter descriptions :: Details :: Example :: References |
| Back to top |
| Back to top |
| Name | Type | Caption | Length | Value range |
|---|---|---|---|---|
| FILE * | String | Input file name | 1 - 192 | |
| DBIC * | Integer | Input raster channel | 1 - 1 | |
| DBIB * | Integer | Input training site bitmaps | 2 - 254 | -254 - |
| VALU | Integer | Gray-level values | 0 - 254 | -254 - |
| PWSIZE * | Integer | Pixel window size | 1 - 1 | |
| DBOC * | Integer | Output classified channel | 1 - 1 | |
| DBOW | Integer | Raster output window | 0 - 4 | Xoffset, Yoffset, Xsize, Ysize |
| REPORT | String | Report mode | 0 - 192 | Quick links |
| MONITOR | String | Monitor mode | 0 - 3 | ON, OFF Default: ON |
| Back to top |
FILE
Specifies the name of the PCIDSK image file that contains the gray-level vector-reduced image and training site bitmap segments.
DBIC
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.
DBIB
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.
Ranges of channels or segments can be specified with negative values. For example, {1,-4,10} is internally expanded to {1,2,3,4,10}. When you are not specifying a range in this way, only 48 numbers can be specified explicitly.
VALU
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.
Ranges of channels or segments can be specified with negative values. For example, {1,-4,10} is internally expanded to {1,2,3,4,10}. When you are not specifying a range in this way, only 48 numbers can be specified explicitly.
PWSIZE
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.
DBOC
Specifies the output channel to receive the classification results.
DBOW
Specifies the raster window (Xoffset, Yoffset, Xsize, Ysize) over which the contextual classification is performed. If this parameter is not specified, the entire layer is processed by default.
Xoffset, Yoffset define the upper-left starting pixel coordinates of the window. Xsize is the number of pixels that define the window width. Ysize is the number of lines that define the window height.
REPORT
Specifies where to direct the generated report.
Available options are:
MONITOR
The program progress can be monitored by printing the percentage of processing completed. A system parameter, MONITOR, controls this activity.
Available options are:
| Back to top |
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).
If an output window (DBOW) is specified, classification is performed only under the specified window.
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 |
Perform a contextual classification by using a vector reduction image and eight training site bitmap segments in the demo file, irvine.pix. Generated classes are assigned values that are the same as those used for the maximum likelihood classifier (see the example for MLC). Set the pixel window size to 7, instead of the default 3, because some of the classes are urban. The output classification image contains zeros for (7-1)/2 = 3 pixels along the border of the image because these pixels cannot be classified.
EASI>file = "irvine.pix" ! input file
EASI>dbic = 8 ! input channel
EASI>dbib = 9,17 ! input training bitmaps
EASI>valu = 10,90,10 ! gray-level values
EASI>pwsize = 7 ! pixel window size
EASI>dboc = 9 ! output channel
EASI>dbow = ! process entire image
EASI>run CONTEXT
The generated report is shown below.
irvine.pix [S 13PIC 512P 512L] 14-Aug-90
Segment Name Code Pixels % Image
9 Water1 10 3066 1.18
10 Water2 20 1796 .69
11 Urban 30 46763 18.05
12 Range 40 119048 45.95
13 Crop1 50 22645 8.74
14 Crop2 60 27442 10.59
15 Crop3 70 941 .36
16 Forest 80 34335 13.25
| Back to top |
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.