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
e = ENVI()
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)
StatTask = ENVITask('TrainingClassificationStatistics')
StatTask.INPUT_RASTER = Raster
StatTask.INPUT_VECTOR = Vector
StatTask.Execute
Task = ENVITask('MinimumDistanceClassification')
Task.INPUT_RASTER = Raster
Task.MEAN = StatTask.Mean
Task.STDDEV = StatTask.STDDEV
Task.Execute
DataColl = e.Data
DataColl.Add, Task.OUTPUT_RASTER
View = e.GetView()
Layer = View.CreateLayer(Task.OUTPUT_RASTER)
Syntax
Result = ENVITask('MinimumDistanceClassification')
Input parameters (Set, Get): CLASS_COLORS, CLASS_NAMES, INPUT_RASTER, MEAN, OUTPUT_RASTER_URI, OUTPUT_RULE_RASTER_URI, STDDEV, THRESHOLD_MAX_DISTANCE, THRESHOLD_STDEV
Output parameters (Get only): OUTPUT_RASTER, OUTPUT_RULE_RASTER
Parameters marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Parameters marked as "Get" are those whose values you can retrieve but not set.
Input Parameters
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_URI (optional)
Specify a string with the fully qualified filename and path to export the associated OUTPUT_RASTER.
- If you do not specify this parameter, the OUTPUT_RASTER will not be created.
- If you set this parameter to an asterisk symbol (*), the OUTPUT_RASTER will be virtual and not written to disk.
- To force the creation of a temporary file, set this parameter to an exclamation symbol (!).
- If you set it to the hash symbol (#), ENVI creates a file in the temporary directory, but this file will not be deleted when ENVI closes.
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 parameter, the OUTPUT_RULE_RASTER will not be created.
- To force the creation of a temporary file set the parameter to an exclamation symbol (!).
- If you set it to the hash symbol (#), ENVI creates a file in the temporary directory, but this file will not be deleted when ENVI closes.
STDDEV (optional)
Specify an array that is [number of bands, number of classes].
THRESHOLD_MAX_DISTANCE (optional)
Specify a value that applies to all classes, or an array of values, one for each class. The smaller the threshold value, the more pixels will be unclassified.
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.
Output Parameters
OUTPUT_RASTER
This is a reference to the output raster of filetype ENVI.
OUTPUT_RULE_RASTER
This is a reference to the output rule image of filetype ENVI.
This output will not be generated unless its associated URI input parameter is set.
Methods
Execute
Parameter
ParameterNames
Properties
DESCRIPTION
DISPLAY_NAME
NAME
REVISION
TAGS
Version History
See Also
ENVITask, MahalanobisDistanceClassification Task, MaximumLikelihoodClassification Task, Masking Support in ENVITasks