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 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
API Version
4.2
See Also
ENVITask, SpectralAdaptiveCoherenceEstimator Task, SpectralAdaptiveCoherenceEstimatorUsingSubspaceBackgroundStatistics Task