ChangeThresholdClassification Task
This task lets you manually set the threshold needed to classify change detection between two images.
Example
This example performs a difference analysis between two images from different dates, then it sets thresholding values for change detection. The images represent NCEP-Reanalysis 2 air temperatures (K) at the 1000-isobar level, at 0600 hours Zulu time. The first image is from 29 December 2012, and the second is from 31 December 2012. Each image has one band. This example uses sample data from the ENVI installation path.
; Start the application
e = ENVI()
TimeSeriesDir = Filepath('', Subdir=['data','time_series'], $
Root_Dir = e.Root_Dir)
files = File_Search(TimeSeriesDir, 'AirTemp*.dat')
numRasters = N_Elements(files)
rasters = ObjArr(numRasters)
FOR i=0, (numRasters-1) DO $
rasters[i] = e.OpenRaster(files[i])
; Get the task from the catalog of ENVITasks
Task = ENVITask('BuildTimeSeries')
; Define inputs
Task.INPUT_RASTERS = rasters
; Run the task
Task.Execute
; Get the raster that corresponds to 0600,
; 29 December 2012 (index #1).
; Indices are zero-based.
SeriesFile = Task.OUTPUT_RASTERSERIES
SeriesFile.Set, 0
Image1 = SeriesFile.Raster
; Get the raster that corresponds to 0600,
; 31 December 2012 (index #9).
; Indices are zero-based.
SeriesFile.Set, 8
Image2 = SeriesFile.Raster
; Get the task from the catalog of ENVITasks
Task = ENVITask('ImageBandDifference')
; Define inputs
Task.INPUT_RASTER1 = Image1
Task.INPUT_RASTER2 = Image2
; Define outputs
Task.OUTPUT_RASTER_URI = e.GetTemporaryFilename()
; Run the task
Task.Execute
; Get the task from the catalog of ENVITasks
ChangeThresholdTask = ENVITask('ChangeThresholdClassification')
; Define inputs
ChangeThresholdTask.INPUT_RASTER = Task.OUTPUT_RASTER
; Define increase and/or decrease values
ChangeThresholdTask.INCREASE_THRESHOLD = 0.0377000
ChangeThresholdTask.DECREASE_THRESHOLD = 0.411400
; Run the task
ChangeThresholdTask.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, ChangeThresholdTask.OUTPUT_RASTER
; Display the result
View = e.GetView()
Layer = View.CreateLayer(ChangeThresholdTask.OUTPUT_RASTER)
Syntax
Result = ENVITask('ChangeThresholdClassification')
Input properties (Set, Get): DECREASE_THRESHOLD, INCREASE_THRESHOLD, INPUT_RASTER, 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:
Properties
This task inherits the following properties from ENVITask:
This task also contains the following properties:
DECREASE_THRESHOLD (optional)
Specify the decrease threshold to show areas of decrease.
INCREASE_THRESHOLD (optional)
Specify the increase threshold to show areas of increase.
INPUT_RASTER (required)
Specify a raster on which to threshold.
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