This task uses pre-defined thresholding techniques to automatically classify change detection between two images.
This example performs a difference analysis between two images from different dates, then it performs automatic thresholding 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.
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])
Task = ENVITask('BuildTimeSeries')
Task.INPUT_RASTERS = rasters
SeriesFile = Task.OUTPUT_RASTERSERIES
Image1 = SeriesFile.Raster
Image2 = SeriesFile.Raster
Task = ENVITask('ImageBandDifference')
Task.INPUT_RASTER1 = Image1
Task.INPUT_RASTER2 = Image2
AutoChangeThreshTask = ENVITask('AutoChangeThresholdClassification')
AutoChangeThreshTask.INPUT_RASTER = Task.OUTPUT_RASTER
DataColl = e.Data
View = e.GetView()
Layer = View.CreateLayer(AutoChangeThreshTask.OUTPUT_RASTER)
Result = ENVITask('AutoChangeThresholdClassification')
Input properties (Set, Get): CHANGE_TYPE, INPUT_RASTER, OUTPUT_RASTER_URI, THRESHOLD_METHOD
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.
This task inherits the following methods from ENVITask:
This task inherits the following properties from ENVITask:
This task also contains the following properties:
Specify the change of interest:
- Both (default): Shows areas of increase (in blue) and decrease (in red).
- Increase: Shows areas of increase (in blue) only.
- Decrease: Shows areas of decrease (in red) only.
Specify a raster on which to threshold.
This is a reference to the output raster of filetype ENVI.
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.
Specify the thresholding method.
- Otsu (default): A histogram shape-based method that is based on discriminate analysis. It uses the zero- and first-order cumulative moments of the histogram for calculating the value of the thresholding level.
- Tsai: A moment-based method. It determines the threshold so that the first three moments of the input image are preserved in the output image.
- Kapur: An entropy-based method. It considers the thresholding image as two classes of events, with each class characterized by a Probability Density Function (PDF). The method then maximizes the sum of the entropy of the two PDFs to converge on a single threshold value.
- Kittler: A histogram shape-based method. It approximates the histogram as a bimodal Gaussian distribution and finds a cutoff point. The cost function is based on the Bayes classification rule.