This task takes two classification images of the same scene taken at different times and identifies differences between them. The resulting classification image shows class transitions, for example, from class 1 to class 2. Thematic change detection can be used to analyze land use, land cover change, deforestation, urbanization, agricultural expansion, water variability, and more.
Example
This example creates a thematic change classification image that shows deforestation in an area of the Amazon rainforest between 1984 and 2013, using Landsat imagery. The two images are available from our ENVI Tutorials web page. Click the Landsat Case Studies link to download the .zip file to your machine, then unzip the files. The files you will use are located in the Deforestation folder of the download. Update the file references in the example with the correct locations.
e = ENVI()
Time1File = 'LandsatAmazon1984.dat'
Time1Raster = e.OpenRaster(Time1File)
Time2File = 'LandsatAmazon2013.dat'
Time2Raster = e.OpenRaster(Time2File)
Time1Subset = ENVISubsetRaster(Time1Raster, BANDS=[5])
Time2Subset = ENVISubsetRaster(Time2Raster, BANDS=[6])
DataColl = e.Data
IntTask = ENVITask('ImageIntersection')
IntTask.INPUT_RASTER1 = Time1Subset
IntTask.INPUT_RASTER2 = Time2Subset
IntTask.Execute
ISODATA1Task = ENVITask('ISODATAClassification')
ISODATA1Task.INPUT_RASTER = IntTask.OUTPUT_RASTER1
ISODATA1Task.NUMBER_OF_CLASSES = 2
ISODATA1Task.Execute
Time1ClassRaster = ISODATA1Task.OUTPUT_RASTER
Time1Metadata = Time1ClassRaster.METADATA
Time1Metadata.UpdateItem, 'CLASS LOOKUP', $
[[0,0,0], [0,128,0], [200,200,200]]
Time1Metadata.UpdateItem, 'CLASS NAMES', $
['Unclassified','Vegetation','No Vegetation']
DataColl.Add, Time1ClassRaster
ISODATA2Task = ENVITask('ISODATAClassification')
ISODATA2Task.INPUT_RASTER = IntTask.OUTPUT_RASTER2
ISODATA2Task.NUMBER_OF_CLASSES = 2
ISODATA2Task.Execute
Time2ClassRaster = ISODATA2Task.OUTPUT_RASTER
Time2Metadata = Time2ClassRaster.METADATA
Time2Metadata.UpdateItem, 'CLASS LOOKUP', $
[[0,0,0], [0,128,0], [200,200,200]]
Time2Metadata.UpdateItem, 'CLASS NAMES', $
['Unclassified','Vegetation','No Vegetation']
DataColl.Add, Time2ClassRaster
Task = ENVITask('ThematicChange')
Task.INPUT_RASTER1 = Time1ClassRaster
Task.INPUT_RASTER2 = Time2ClassRaster
Task.MERGE_NO_CHANGE = 'True'
Task.OUTPUT_RASTER_URI = e.GetTemporaryFilename()
Task.Execute
DataColl.Add, Task.OUTPUT_RASTER
View = e.GetView()
Layer = View.CreateLayer(Task.OUTPUT_RASTER)
View.Zoom, /FULL_EXTENT
Syntax
Result = ENVITask('ThematicChange')
Input parameters (Set, Get): INPUT_RASTER1, INPUT_RASTER2, MERGE_NO_CHANGE, 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
INPUT_RASTER1 (required)
Specify a classification raster representing the earliest time.
INPUT_RASTER2 (required)
Specify a second classification raster representing the latest time.
MERGE_NO_CHANGE (optional)
If the two input classification images have the same number of classes that use the same class name, set this parameter to true to group them into a class named "no change" if there was no difference detected during processing. Set this parameter to false if the output is a new classification image that includes all class transition information. The default value is true.
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, ISODATAClassification Task, MahalanobisDistanceClassification Task, MaximumLikelihoodClassification Task, MinimumDistanceClassification Task, SpectralAngleMapperClassification Task, Masking Support in ENVITasks