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:
e = ENVI()
specLibFile = FILEPATH('veg_2grn.sli', ROOT_DIR=e.ROOT_DIR, $
SUBDIR=['resource', 'speclib', 'veg_lib'])
specLib = ENVISpectralLibrary(specLibFile)
file = FILEPATH('AVIRISReflectanceSubset.dat', $
ROOT_DIR=e.ROOT_DIR, $
SUBDIRECTORY = ['data', 'hyperspectral'])
raster = e.OpenRaster(file)
metadata = raster.METADATA
wavelengths = metadata['Wavelength']
wavelengthUnits = metadata['Wavelength Units']
Task1 = ENVITask('GetSpectrumFromLibrary')
Task1.INPUT_SPECTRAL_LIBRARY = specLib
Task1.SPECTRUM_NAME = 'Dry Grass'
Task1.Execute
Task2 = ENVITask('ResampleSpectrum')
Task2.INPUT_SPECTRUM = Task1.SPECTRUM
Task2.INPUT_WAVELENGTHS = Task1.WAVELENGTHS
Task2.INPUT_WAVELENGTH_UNITS = Task1.WAVELENGTH_UNITS
Task2.RESAMPLE_WAVELENGTHS = wavelengths
Task2.RESAMPLE_WAVELENGTH_UNITS = wavelengthUnits
Task2.Execute
Task3 = ENVITask('SpectralSubspaceBackgroundStatistics')
Task3.INPUT_RASTER = raster
Task3.THRESHOLD = 0.6
Task3.Execute
ACETask = ENVITask('SpectralAdaptiveCoherenceEstimator')
ACETask.INPUT_RASTER = raster
ACETask.SPECTRA = Task2.OUTPUT_SPECTRUM
ACETask.MEAN = Task3.MEAN
ACETask.COVARIANCE = Task3.COVARIANCE
ACETask.Execute
DataColl = e.Data
DataColl.Add, ACETask.OUTPUT_RASTER
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
Execute
Parameter
ParameterNames
Properties
DESCRIPTION
DISPLAY_NAME
NAME
REVISION
TAGS
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