This task performs a Maximum Likelihood supervised classification. Maximum Likelihood assumes that the statistics for each class in each band are normally distributed and calculates the probability that a given pixel belongs to a specific class. Each pixel is assigned to the class that has the highest probability.
Example
e = ENVI()
File1 = Filepath('qb_boulder_msi', Subdir=['data'], $
Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File1)
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('MaximumLikelihoodClassification')
Task.INPUT_RASTER = Raster
Task.COVARIANCE = StatTask.Covariance
Task.MEAN = StatTask.Mean
Task.Execute
DataColl = e.Data
DataColl.Add, Task.OUTPUT_RASTER
View = e.GetView()
Layer = View.CreateLayer(Task.OUTPUT_RASTER)
Syntax
Result = ENVITask('MaximumLikelihoodClassification')
Input properties (Set, Get): CLASS_COLORS, CLASS_NAMES, COVARIANCE, INPUT_RASTER, MEAN, OUTPUT_RASTER_URI, OUTPUT_RULE_RASTER_URI, THRESHOLD_PROBABILITY
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:
AddParameter
Execute
Parameter
ParameterNames
RemoveParameter
Properties
This task inherits the following properties from ENVITask:
COMMUTE_ON_DOWNSAMPLE
COMMUTE_ON_SUBSET
DESCRIPTION
DISPLAY_NAME
NAME
REVISION
TAGS
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.
COVARIANCE (required)
Specify an array that is [number of bands, number of bands, number of classes].
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 (!).
THRESHOLD_PROBABILITY (optional)
Enter a scalar value for all classes or array of values, one per class, from 0 to and 1. For arrays, the number of elements must equal the number of classes. Pixels with a value lower than the threshold will not be classified. The default value is 0.00000000. The threshold is a probability minimum for inclusion in a class. For example, a value of 0.9 will include fewer pixels in a class than a value of 0.5 because a 90 percent probability requirement is more strict than allowing a pixel in a class based on a chance of 50 percent.
Version History
API Version
4.3
See Also
ENVITask, MahalanobisDistanceClassification Task, MinimumDistanceClassification Task