>  Docs Center  >  ENVI API  >  Processing  >  ENVISpectralSubspaceBackgroundStatisticsTask

ENVISpectralSubspaceBackgroundStatisticsTask

ENVISpectralSubspaceBackgroundStatisticsTask

This task computes background statistics by excluding anomalous pixels. When the true background is better characterized with a subspace background, spectral detection methods such as ENVISpectralAdaptiveCoherenceEstimatorTask achieve greater target-to-background separation. This can potentially improve detection results, particularly in scenes that contain a lot of clutter or man-made objects.

Alternatively, use ENVISpectralAdaptiveCoherenceEstimatorUsingSubspaceBackgroundStatisticsTask to run the ACE algorithm with subspace background statistics using just one task.

Example


ACE target detection involves multiple steps, as this code example demonstrates:

  1. Open a spectral library.
  2. Open a hyperspectral image.
  3. Get the wavelength values and units from the image.
  4. Choose an individual spectrum from the spectral library.
  5. Resample the spectrum to the wavelengths of the image.
  6. Compute subspace background statistics.
  7. Run ACE target detection.
  8. Display the resulting image. Brighter pixels represent a close match to the Dry Grass spectrum.

This example takes several minutes to complete. Copy and paste the following code into the IDL Editor:

; Launch the application
e = ENVI()
 
; Open a spectral library
specLibFile = FILEPATH('veg_2grn.sli', ROOT_DIR=e.ROOT_DIR, $
  SUBDIR=['resource', 'speclib', 'veg_lib'])
specLib = ENVISpectralLibrary(specLibFile)
 
; Open a hyperspectral image       
file = FILEPATH('AVIRISReflectanceSubset.dat', $
  ROOT_DIR=e.ROOT_DIR, $
  SUBDIRECTORY = ['data', 'hyperspectral'])
raster = e.OpenRaster(file)
 
; Get wavelength values and units from raster
metadata = raster.METADATA
wavelengths = metadata['Wavelength']
wavelengthUnits = metadata['Wavelength Units']
 
; Get the selected spectrum from spectral library
Task1 = ENVITask('GetSpectrumFromLibrary')
Task1.INPUT_SPECTRAL_LIBRARY = specLib
Task1.SPECTRUM_NAME = 'Dry Grass'
Task1.Execute
 
; Get the resample spectrum task from the catalog of ENVITasks
Task2 = ENVITask('ResampleSpectrum')
 
; Define inputs
; Spectrum from library to be resampled
Task2.INPUT_SPECTRUM = Task1.SPECTRUM
 
; Wavelengths from spectral library
Task2.INPUT_WAVELENGTHS = Task1.WAVELENGTHS
 
; Wavelength units from spectral library
Task2.INPUT_WAVELENGTH_UNITS = Task1.WAVELENGTH_UNITS
 
; Wavelengths from raster
Task2.RESAMPLE_WAVELENGTHS = wavelengths
 
; Wavelength units from raster
Task2.RESAMPLE_WAVELENGTH_UNITS = wavelengthUnits
 
; Run the resample spectrum task
Task2.Execute
 
; Get the subspace background task
Task3 = ENVITask('SpectralSubspaceBackgroundStatistics')
 
; Define inputs
Task3.INPUT_RASTER = raster
Task3.THRESHOLD = 0.6
 
; Run the subspace background task
Task3.Execute
 
; Get the ACE task from the catalog of ENVITasks
ACETask = ENVITask('SpectralAdaptiveCoherenceEstimator')
 
; Define inputs
ACETask.INPUT_RASTER = raster
ACETask.SPECTRA = Task2.OUTPUT_SPECTRUM
ACETask.MEAN = Task3.MEAN
ACETask.COVARIANCE = Task3.COVARIANCE
 
; Run the task
ACETask.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, ACETask.OUTPUT_RASTER
 
; Display the result
View = e.GetView()
Layer = View.CreateLayer(ACETask.OUTPUT_RASTER)

Syntax


Result = ENVITask('SpectralSubspaceBackgroundStatistics')

Input properties (Set, Get): INPUT_RASTER, THRESHOLD

Output properties (Get only): COVARIANCE, EIGENVALUES, MEAN

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:

COVARIANCE (optional)

The covariance matrix of the subspace background, returned as a double-precision array [number of bands, number of bands].

EIGENVALUES (optional)

The eigenvalues of the subspace background.

INPUT_RASTER (required)

Specify the raster on which to compute the subspace background statistics.

MEAN (optional)

The mean of the subspace background, one for each band of the input raster.

THRESHOLD (optional)

Specify the fraction of the background to use for calculating the subspace background statistics. The data type is floating-point. The allowable range is 0.5 to 1.0 (the entire image).

Version History


ENVI 5.2, Service Pack 1

Introduced

API Version


3.3

See Also


ENVITask, ENVITask::Parameter, ENVISubsetRaster, ENVISpectralAdaptiveCoherenceEstimatorTask, ENVISpectralAdaptiveCoherenceEstimatorUsingSubspaceBackgroundStatisticsTask



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us