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


; Start the application
e = ENVI()
 
; Open an input file
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)
 
; 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('MaximumLikelihoodClassification')
 
; Define inputs
Task.INPUT_RASTER = Raster
Task.COVARIANCE = StatTask.Covariance
Task.MEAN = StatTask.Mean
 
; 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('MaximumLikelihoodClassification')

Input parameters (Set, Get): CLASS_COLORS, CLASS_NAMES, COVARIANCE, INPUT_RASTER, MEAN, OUTPUT_RASTER_URI, OUTPUT_RULE_RASTER_URI, REGULARIZATION_METHOD, REGULARIZATION_TOLERANCE, THRESHOLD_PROBABILITY

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.

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_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.

REGULARIZATION_METHOD (optional)

Specify a method for regularizing the covariance matrix:

  • Diagonal: Diagonal loading, increasing all singular values by the tolerance value.
  • Dominant: Dominant mode rejection, setting singular values less than the tolerance value to their mean.
  • None: No regularization is used.
  • Shrink: Shrinkage of singular values based on the tolerance value.
  • Threshold: Singular values less than the tolerance value are set to the tolerance value.
  • Truncate (default): Singular values less than the tolerance value are set to zero.

REGULARIZATION_TOLERANCE (optional)

Specify the tolerance value to use for matrix regularization. If not set, the following values will be used based on the regularization method

  • Diagonal: Ten times the smallest nonzero singular value.
  • Dominant: The value prescribed by Gavish & Donoho.
  • None: N/A
  • Shrink: The Oracle Approximating Shrinkage (OAS) estimator.
  • Threshold: The largest singular value times the machine precision.
  • Truncate (default): The largest singular value times the machine precision.

THRESHOLD_PROBABILITY (optional)

Enter a scalar value for all classes or array of values, one per class, from 0.0 to 1.0. 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.0. 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.

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


ENVI 5.2

Introduced

ENVI 6.2

Added the REGULARIZATION_METHOD and REGULARIZATION_TOLERANCE parameters

See Also


ENVITask, MahalanobisDistanceClassification Task, MinimumDistanceClassification Task, Masking Support in ENVITasks