SpectralSubspaceBackgroundStatistics Task
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 the SpectralAdaptiveCoherenceEstimator task 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 the SpectralAdaptiveCoherenceEstimatorUsingSubspaceBackgroundStatistics task 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:
- Open a spectral library.
- Open a hyperspectral image.
- Get the wavelength values and units from the image.
- Choose an individual spectrum from the spectral library.
- Resample the spectrum to the wavelengths of the image.
- Compute subspace background statistics.
- Run ACE target detection.
- 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 parameters (Set, Get): INPUT_RASTER, THRESHOLD
Output parameters (Get only): AUTOCORRELATION, CORRELATION, COVARIANCE, EIGENVALUES, EIGENVECTORS, MAX, MEAN, MIN, NPIXELS, STDDEV
Parameters marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Parameters marked as "Get" are those whose values you can retrieve but not set.
Input Parameters
INPUT_RASTER (required)
Specify the raster on which to compute the subspace background statistics.
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).
Output Parameters
AUTOCORRELATION
The autocorrelation matrix of the subspace background, returned as a double-precision array [number of bands, number of bands].
CORRELATION
The correlation matrix of the subspace background, returned as a double-precision array [number of bands, number of bands].
COVARIANCE
The covariance matrix of the subspace background, returned as a double-precision array [number of bands, number of bands].
EIGENVALUES
The eigenvalues of the subspace background, returned as a double-precision array.
EIGENVECTORS
The eigenvectors of the subspace background, returned as a double-precision array [number of bands, number of bands].
MAX
The maximum value of each band in the subspace background.
MEAN
The mean of the subspace background, one for each band of the input raster.
MIN
The minimum value of each band in the subspace background.
NPIXELS
The number of pixels in the subspace background of the raster.
STDDEV
The standard deviation data value of the subspace background for each band.
Methods
Properties
Version History
|
ENVI 5.2.1 |
Introduced |
|
ENVI 6.2 |
Added AUTOCORRELATION, CORRELATION, EIGENVECTORS, MAX, MIN, NPIXELS, and STDDEV parameters. |
See Also
ENVITask, SpectralAdaptiveCoherenceEstimator Task, SpectralAdaptiveCoherenceEstimatorUsingSubspaceBackgroundStatistics Task, Masking Support in ENVITasks