MinimumDistanceClassification Task
This task performs a Minimum Distance supervised classification. Minimum Distance uses the mean vectors for each class and calculates the Euclidean distance from each unknown pixel to the mean vector for each class. The pixels are classified to the nearest class.
Example
; Start the application
e = ENVI()
; Open an input raster and vector
File = Filepath('qb_boulder_msi', Subdir=['data'], $
Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
File2 = Filepath('qb_boulder_msi_vectors.shp', Subdir=['data'], $
Root_Dir=e.Root_Dir)
Vector = e.OpenVector(File2)
; Get training statistics
StatTask = ENVITask('TrainingClassificationStatistics')
StatTask.INPUT_RASTER = Raster
StatTask.INPUT_VECTOR = Vector
StatTask.Execute
; Get the task from the catalog of ENVITasks
Task = ENVITask('MinimumDistanceClassification')
; Define inputs
Task.INPUT_RASTER = Raster
Task.MEAN = StatTask.Mean
Task.STDEV = StatTask.STDDEV
; Run the task
Task.Execute
; Get the collection of data objects currently available in the Data Manager
DataColl = e.Data
; Add the output to the Data Manager
DataColl.Add, Task.OUTPUT_RASTER
; Display the result
View = e.GetView()
Layer = View.CreateLayer(Task.OUTPUT_RASTER)
Syntax
Result = ENVITask('MinimumDistanceClassification')
Input properties (Set, Get): CLASS_COLORS, CLASS_NAMES, INPUT_RASTER, MEAN, OUTPUT_RASTER_URI, OUTPUT_RULE_RASTER_URI, STDDEV, THRESHOLD_MAX_DISTANCE, THRESHOLD_STDEV
Output properties (Get only): OUTPUT_RASTER, OUTPUT_RULE_RASTER
Properties marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Properties marked as "Get" are those whose values you can retrieve but not set.
Methods
This task inherits the following methods from ENVITask:
Properties
This task inherits the following properties from ENVITask:
This task also contains the following properties:
CLASS_COLORS (optional)
This is an array of RGB triplets representing the class colors as defined by the input vector.
CLASS_NAMES (optional)
This is a string array of class names as defined by the input vector.
INPUT_RASTER (required)
Specify a raster on which to perform supervised classification.
MEAN (required)
Specify an array that is [number of bands, number of classes].
OUTPUT_RASTER
This is a reference to the output raster of filetype ENVI.
OUTPUT_RASTER_URI (optional)
Specify a string with the fully qualified filename and path to export the associated OUTPUT_RASTER.
- If you set this property to an asterisk symbol (*), the output raster will be virtual and not written to disk.
- If you do not specify this property, the associated output raster will not be created. To force the creation of a temporary file, set this parameter to an exclamation symbol (!).
OUTPUT_RULE_RASTER
This is a reference to the output rule image of filetype ENVI.
OUTPUT_RULE_RASTER_URI (optional)
Specify a string with the fully qualified filename and path of the associated OUTPUT_RULE_RASTER. If you do not specify this property, the associated OUTPUT_RULE_RASTER will not be created. To force the creation of a temporary file set the property to an exclamation symbol (!).
STDDEV (optional)
Specify an array that is [number of bands, number of classes].
THRESHOLD_MAX_DISTANCE (optional)
Specify a pixel value between 0 and 10000000 that applies to all classes, or specify an array of pixel values, one for each class. The number of array elements must equal the number the number of classes. This value represents a distance threshold. The smaller the threshold, the more pixels that are unclassified. The pixel of interest must be within both the threshold for distance to mean and the threshold for the standard deviation for a class. The condition for Minimum Distance reduces to the lesser of the two thresholds. A higher value for each parameter is more inclusive because more pixels are included in a class for a higher threshold.
THRESHOLD_STDDEV (optional)
Specify the number of standard deviations to use around the mean for all classes, or specify an array of values, one for each class. Enter a pixel value between 0 and 10000000. ENVI does not classify pixels outside this range. The lower the value, the more pixels that are unclassified.
Version History
ENVI 5.2 |
Introduced |
API Version
4.2
See Also
ENVITask, MahalanobisDistanceClassification Task, MaximumLikelihoodClassification Task