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.
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 properties (Set, Get): INPUT_RASTER1, INPUT_RASTER2, MERGE_NO_CHANGE, OUTPUT_RASTER_URI
Output properties (Get only): OUTPUT_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:
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 property to true to group them into a class named "no change" if there was no difference detected during processing. Set this property to false if the output is a new classification image that includes all class transition information.
The default value is true.
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 of the associated OUTPUT_RASTER. If you do not specify this property, or set it to an exclamation symbol (!), a temporary file will be created.
Version History
API Version
4.3
See Also
ENVITask, ISODATAClassification Task, MahalanobisDistanceClassification Task, MaximumLikelihoodClassification Task, MinimumDistanceClassification Task, SpectralAngleMapperClassification Task