This task performs a clumping method on a classification image. This operation clumps adjacent similar classified areas using morphological operators. Classified images often suffer from a lack of spatial coherency (speckle or holes in classified areas). Low pass filtering could be used to smooth these images, but the class information would be contaminated by adjacent class codes. Clumping classes solves this problem. The selected classes are clumped together by first performing a dilate operation then an erode operation on the classified image using one specified kernel (structuring element) for each operation.
Example
The following example performs an unsupervised classification, followed by a sieving, then clumping operation to remove the remaining black pixels.
e = ENVI()
File = Filepath('qb_boulder_msi', Subdir=['data'], $
Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
ClassTask = ENVITask('ISODATAClassification')
ClassTask.INPUT_RASTER = Raster
ClassTask.Execute
DataColl = e.Data
DataColl.Add, ClassTask.OUTPUT_RASTER
View = e.GetView()
Layer = View.CreateLayer(ClassTask.OUTPUT_RASTER)
SievingTask = ENVITask('ClassificationSieving')
SievingTask.INPUT_RASTER = ClassTask.OUTPUT_RASTER
SievingTask.Execute
ClumpingTask = ENVITask('ClassificationClumping')
ClumpingTask.INPUT_RASTER = SievingTask.OUTPUT_RASTER
ClumpingTask.Execute
DataColl.Add, ClumpingTask.OUTPUT_RASTER
Layer2 = View.CreateLayer(ClumpingTask.OUTPUT_RASTER)
Portal = View.CreatePortal()
Portal.Animate, 2.0, /FLICKER
Syntax
Result = ENVITask('ClassificationClumping')
Input parameters (Set, Get): CLASS_ORDER, DILATE_KERNEL, ERODE_KERNEL, INPUT_RASTER, OUTPUT_RASTER_URI
Output parameters (Get only):OUTPUT_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_ORDER (optional)
Specify the order of class names in which clumping is applied to the classification image. If you do not specify this parameter, the classes are processed from first to last.
DILATE_KERNEL (required)
Specify a 2D array of zeros and ones that represents the structuring element (kernel) used for a dilate operation. If no kernel is specified, a 3 x 3 array will be used with a value of 1 for all of the array elements. Dilation is a morphological operation that uses a structuring element to expand the shapes contained in the input image.
ERODE_KERNEL (required)
Specify a 2D array of zeros and ones that represents the structuring element (kernel) used for a erode operation. If no kernel is specified, a 3 x 3 array will be used with a value of 1 for all of the array elements. Erosion is a morphological operation that uses a structuring element to reduce the shapes contained in the input image.
INPUT_RASTER (required)
Specify a raster on which to perform classification clumping.
OUTPUT_RASTER_URI (optional)
Specify a string with the fully qualified filename and path of the associated OUTPUT_RASTER.
- If you do not specify this parameter, or set it to an exclamation symbol (!), ENVI creates a temporary file.
- 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 Parameters
OUTPUT_RASTER
This is a reference to the output raster of filetype ENVI.
Methods
Execute
Parameter
ParameterNames
Properties
DESCRIPTION
DISPLAY_NAME
NAME
REVISION
TAGS
Version History
See Also
ENVITask, ENVISubsetRaster, ISODATAClassification Task, ClassificationSmoothing Task, ClassificationAggregation Task, ClassificationSieving Task