GBDX

ENVI® Change Threshold Classification

This task lets you manually set the threshold needed to classify change detection between two images.

GBDX Registered Name: ENVI_ChangeThresholdClassification
Provider: Harris Geospatial Solutions

Imagery Examples

Before: Two WorldWiew 2 images taken at different times

Before: Two WorldWiew 2 images taken at different times

After: After a change detection classification based on the above two images

After: After a change detection classification based on the above two images

Quickstart

This is a workflow example for basic processing.

# Quickstart Example running the task name.

# Initialize the Environment.
from os.path import join, split
from gbdxtools import Interface
gbdx = Interface()

tasks = []
output_location = 'ENVI/ChangeThresholdClassification'

# Change Detection task setup
pre_cat_id = '103001001EC17D00'
post_cat_id = '103001001C423600'

# Pre-Image Auto ordering task parameters
pre_order = gbdx.Task("Auto_Ordering")
pre_order.inputs.cat_id = pre_cat_id
pre_order.impersonation_allowed = True
pre_order.persist = True
pre_order.timeout = 36000
tasks += [pre_order]

# Pre-Image AOP task parameters
pre_aop = gbdx.Task("AOP_Strip_Processor")
pre_aop.inputs.data = pre_order.outputs.s3_location.value
pre_aop.inputs.bands = 'MS'
pre_aop.inputs.enable_dra = False
pre_aop.outputs.data.persist = True
pre_aop.outputs.data.persist_location = output_location+'/pre_aop'
pre_aop.timeout = 36000
tasks += [pre_aop]

# Post-Image Auto ordering task parameters
post_order = gbdx.Task("Auto_Ordering")
post_order.inputs.cat_id = post_cat_id
post_order.impersonation_allowed = True
post_order.persist = True
post_order.timeout = 36000
tasks += [post_order]

# Post-Image AOP task parameters
post_aop = gbdx.Task("AOP_Strip_Processor")
post_aop.inputs.data = post_order.outputs.s3_location.value
post_aop.inputs.bands = 'MS'
post_aop.inputs.enable_dra = False
post_aop.outputs.data.persist = True
post_aop.outputs.data.persist_location = output_location+'/post_aop'
post_aop.timeout = 36000
tasks += [post_aop]

# Create an NDVI Product from the first image
envi_ndvi1 = gbdx.Task("ENVI_SpectralIndex")
envi_ndvi1.inputs.input_raster = pre_aop.outputs.data.value
envi_ndvi1.inputs.index = "Normalized Difference Vegetation Index"
tasks += [envi_ndvi1]

# Create an NDVI Product from the second image
envi_ndvi2 = gbdx.Task("ENVI_SpectralIndex")
envi_ndvi2.inputs.input_raster = post_aop.outputs.data.value
envi_ndvi2.inputs.index = "Normalized Difference Vegetation Index"
tasks += [envi_ndvi2]

# Find where the images intersect
envi_II = gbdx.Task("ENVI_ImageIntersection")
envi_II.inputs.input_raster1 = envi_ndvi1.outputs.output_raster_uri.value
envi_II.inputs.input_raster2 = envi_ndvi2.outputs.output_raster_uri.value
tasks += [envi_II]

# Calculate a difference image
envi_IBD = gbdx.Task("ENVI_ImageBandDifference")
envi_IBD.inputs.input_raster1 = envi_II.outputs.output_raster1_uri.value
envi_IBD.inputs.input_raster2 = envi_II.outputs.output_raster2_uri.value
tasks += [envi_IBD]

# Change Threshold Classification setup
envi_CTC = gbdx.Task("ENVI_ChangeThresholdClassification")
envi_CTC.inputs.increase_threshold = "0.1"
envi_CTC.inputs.decrease_threshold = "0.5"
envi_CTC.inputs.input_raster = envi_IBD.outputs.output_raster_uri.value
tasks += [envi_CTC]

workflow = gbdx.Workflow(tasks)
workflow.savedata(
    envi_CTC.outputs.output_raster_uri, location=output_location
)

workflow.execute()

Inputs

The following table lists all ENVI_ChangeThresholdClassification inputs.
Mandatory (optional) settings are listed as Required = True (Required = False).

Name Required Default Valid Values Description
file_types False N/A string GBDX Option. Comma seperated list of permitted file type extensions. Use this to filter input files -- Value Type: STRING[*]
input_raster True N/A See ENVIRASTER input type Specify a raster on which to threshold. -- Value Type: ENVIRASTER
input_raster_format False N/A See ENVIRASTER input type Provide the format of the image, for example: landsat-8. -- Value Type: STRING
input_raster_band_grouping False N/A See ENVIRASTER input type Provide the name of the band grouping to be used in the task, ie - panchromatic. -- Value Type: STRING
input_raster_filename False N/A See ENVIRASTER input type Provide the explicit relative raster filename that ENVI will open. This overrides any file lookup in the task runner. -- Value Type: STRING
input_raster_raw_output False False See ENVIRASTER input type Provide True to output an ENVI Binary instead of a tif. -- Value Type: STRING
increase_threshold False N/A string Specify the increase threshold to show areas of increase. -- Value Type: DOUBLE
decrease_threshold False N/A string Specify the decrease threshold to show areas of decrease. -- Value Type: DOUBLE
output_raster_uri_filename False N/A string Specify a string with the fully-qualified path and filename for OUTPUT_RASTER. -- Value Type: STRING

Outputs

The following table lists all ENVI_ChangeThresholdClassification outputs.
Mandatory (optional) settings are listed as Required = True (Required = False).

Name Required Default Valid Values Description
task_meta_data False N/A directory GBDX Option. Output location for task meta data such as execution log and output JSON
output_raster_uri True N/A directory Output for OUTPUT_RASTER. -- Value Type: ENVIURI

Output structure

The output_raster_uri file will be written to the specified S3 Customer Account Location.

Issues

Input rasters for the ENVI_AutoChangeThresholdClassification task will require pre-processing to fit specific input requirements. Auto threshold may also require experimentation and iteration to find an acceptable threshold method (e.g. Kapur may not be the ideal method for a given raster dataset)

Background

For additional background information on this task please refer to the Harris Geospatial ENVI documentation and
ENVI® Change Threshold Classification.

Contact

If you have any questions or issues with this task, please contact gbdx-support@digitalglobe.com.