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.

; Start the application
e = ENVI()
 
; Open the before-and-after rasters
Time1File = 'LandsatAmazon1984.dat'
Time1Raster = e.OpenRaster(Time1File)
Time2File = 'LandsatAmazon2013.dat'
Time2Raster = e.OpenRaster(Time2File)
 
; Create a spectral subset of the SWIR band only since it
; delineates vegetation from non-vegetation features.
; Bands are zero-based.
Time1Subset = ENVISubsetRaster(Time1Raster, BANDS=[5])
Time2Subset = ENVISubsetRaster(Time2Raster, BANDS=[6])
 
; Get the collection of data objects currently available in the Data Manager
DataColl = e.Data
 
; Use the image intersection task to get the
; overlapping area between the two images
IntTask = ENVITask('ImageIntersection')
IntTask.INPUT_RASTER1 = Time1Subset
IntTask.INPUT_RASTER2 = Time2Subset
IntTask.Execute
 
; Get the classification task from the catalog of ENVITasks
ISODATA1Task = ENVITask('ISODATAClassification')
 
; Define parameters for Time 1 raster
ISODATA1Task.INPUT_RASTER = IntTask.OUTPUT_RASTER1
ISODATA1Task.NUMBER_OF_CLASSES = 2
ISODATA1Task.Execute
Time1ClassRaster = ISODATA1Task.OUTPUT_RASTER
 
; Change class names and colors
Time1Metadata = Time1ClassRaster.METADATA
Time1Metadata.UpdateItem, 'CLASS LOOKUP', $
  [[0,0,0], [0,128,0], [200,200,200]]
Time1Metadata.UpdateItem, 'CLASS NAMES', $
  ['Unclassified','Vegetation','No Vegetation']
 
; Add the result to the Data Manager
DataColl.Add, Time1ClassRaster
 
; Define parameters for Time 2 raster
ISODATA2Task = ENVITask('ISODATAClassification')
ISODATA2Task.INPUT_RASTER = IntTask.OUTPUT_RASTER2
ISODATA2Task.NUMBER_OF_CLASSES = 2
ISODATA2Task.Execute
Time2ClassRaster = ISODATA2Task.OUTPUT_RASTER
 
; Change class names and colors
Time2Metadata = Time2ClassRaster.METADATA
Time2Metadata.UpdateItem, 'CLASS LOOKUP', $
  [[0,0,0], [0,128,0], [200,200,200]]
Time2Metadata.UpdateItem, 'CLASS NAMES', $
  ['Unclassified','Vegetation','No Vegetation']
 
; Add the result to the Data Manager
DataColl.Add, Time2ClassRaster
 
; Perform thematic change detection
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
 
; Display the result
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


ENVI 5.2

Introduced

API Version


4.2

See Also


ENVITask, ISODATAClassification Task, MahalanobisDistanceClassification Task, MaximumLikelihoodClassification Task, MinimumDistanceClassification Task, SpectralAngleMapperClassification Task