A comprehensive MATLAB toolbox for hyperspectral image processing and analysis, providing state-of-the-art exploitation algorithms for research and educational purposes.
This toolbox was originally developed to support research for my Master's thesis "An Evaluation of Three Endmember Extraction Algorithms: ATGP, ICA-EEA, and VCA" under the advisorship of Dr. Tim Kane at Penn State's Remote Sensing and Space Systems Lab. The work has since evolved into a broader collection of hyperspectral analysis tools that continues to serve the remote sensing research community.
Demonstration of how different SNR levels affect spectral signatures, from 10dB (high noise) to 60dB (low noise). This understanding is crucial for processing real sensor data.
Decorrelation stretched image computed from bands 199, 126 and 51 (RGB) showing the Moffett Field, CA test site
Abundance map showing the distribution of Sagebrush across the Moffett Field, CA region
Abundance map showing the distribution of Lichen across the Moffett Field, CA region
Abundance map showing the distribution of Oak Trees across the Moffett Field, CA region
Abundance map showing the distribution of Antigorite across the Moffett Field, CA region Progressive examples of material abundance mapping showing different material concentrations overlaid on Google Earth imagery of Moffett Field, CA. These maps demonstrate the toolbox's ability to identify and quantify material distributions across a scene.
The toolbox includes implementations of various hyperspectral exploitation algorithms:
- Target Detection Algorithms
- RX Detector
- Matched Filter
- ACE (Adaptive Cosine Estimator)
- Various hybrid detectors
- Material Abundance Mapping
- FCLS (Fully Constrained Least Squares)
- UCLS (Unconstrained Least Squares)
- NNLS (Non-Negative Least Squares)
- Spectral Unmixing
- VCA (Vertex Component Analysis)
- ICA-EEA (Independent Component Analysis - Endmember Extraction Algorithm)
- ATGP (Automated Target Generation Process)
- Data Processing
- MNF (Minimum Noise Fraction)
- PCA (Principal Component Analysis)
- Spectral Angle Mapper (SAM)
- Spectral Information Divergence (SID)
- Visualization Tools
- 2D/3D data conversion
- Colormap generation
- Advanced plotting functions
- AVIRIS (.rfl) reading
- ASD FieldSpec file reading
- ENVI signature import
- SPECPR file format support
- Various hyperspectral data format conversions
- MATLAB (version requirements TBD)
- FastICA Toolbox - Required for certain unmixing functions
- Add to MATLAB's path using
addpath('path_to_fastica')
- Add to MATLAB's path using
- Clone the repository:
git clone https://github.com/isaacgerg/matlabHyperspectralToolbox.git
- Add the toolbox to your MATLAB path:
addpath('path_to_toolbox')
- Install FastICA if needed for unmixing functionality
The toolbox includes several demo scripts to help you get started:
hyperDemo.m
- General toolbox functionalityhyperDemo_detectors.m
- Target detection algorithmshyperDemo_RIT_data.m
- Working with RIT datasethyperDemo_ASD_reader.m
- Reading ASD FieldSpec data
Implements the ACE detector which normalizes the matched filter by both the background clutter energy and target energy:
ACE(x) = (s^T Σ^(-1) x)^2 / ((s^T Σ^(-1) s)(x^T Σ^(-1) x))
where s is the target signature, x is the test pixel, and Σ is the background covariance matrix.
Implements a GLRT detector for signals in subspace interference:
AMSD = (x^T P_B⊥ x - x^T P_(B,S)⊥ x) / (x^T P_(B,S)⊥ x)
where P_B⊥ is the projection onto the orthogonal complement of the background subspace.
Implements an orthogonal projection-based endmember extraction:
- Finds pixel with largest magnitude
- Projects data onto space orthogonal to found pixel
- Repeats until desired number of endmembers found
Implements the GLRT detector:
GLRT(x) = (s^T Σ^(-1) x)^2 / (s^T Σ^(-1) s)
Similar to ACE but without normalization by the pixel energy.
Implements noise-adjusted principal components:
- Estimates noise covariance Σn
- Whitens data using noise covariance
- Performs PCA on whitened data
MNF = eig(Σn^(-1/2) Σ Σn^(-1/2))
Similar to MNF but uses a different noise estimation approach.
Implements data whitening:
x_white = Σ^(-1/2) x
where Σ^(-1/2) is computed via eigendecomposition.
Solves the constrained optimization problem:
min ||Ax - b||^2 subject to sum(x) = 1 and x ≥ 0
where A contains endmember signatures and x contains abundances.
Note: This implementation contains a correction to the original formulation presented in "Fully Constrained Least-Squares Based Linear Unmixing" (Heinz, Chang, and Althouse, IEEE 1999).
Solves:
min ||Ax - b||^2 subject to x ≥ 0
Solves the basic least squares problem:
min ||Ax - b||^2
Implements VCA endmember extraction by:
- Projecting data onto random vector
- Finding extreme projections
- Iterating with orthogonal projections
Computes Pearson correlation coefficient:
ρ = cov(x,y) / (σx σy)
Computes normalized cross correlation:
NCC = (x^T y) / (||x|| ||y||)
Computes spectral angle:
θ = arccos((x^T y) / (||x|| ||y||))
Computes information theoretic measure of spectral similarity using relative entropy.
Combines structured (matched filter) and unstructured (RX) detectors:
HUD = αRX + (1-α)MF
Implements anomaly detection:
RX(x) = (x-μ)^T Σ^(-1) (x-μ)
where μ is the mean and Σ is the covariance.
Removes pixels inside the convex hull of selected vertices.
Removes vertical striping artifacts in push-broom sensors.
Normalizes spectra to unit length:
x_norm = x / ||x||
Resamples spectra to new wavelength positions using interpolation.
Uses FastICA to find statistically independent endmembers:
- Reduces dimensionality via PCA
- Applies ICA to find independent components
- Projects back to original space
Computes abundance maps from ICA components.
Reads ASD FieldSpec spectrometer files.
Reads AVIRIS reflectance data.
Reads SPECPR format spectral library files.
Reads spectral signatures from ENVI spectral libraries.
Converts hyperspectral image to RGB using dimensionality reduction.
Converts between 2D (samples × bands) and 3D (rows × cols × bands) formats.
Enhanced visualization of hyperspectral data cubes.
Finds local maxima in 2D arrays.
Computes measure of pixel spectral purity through repeated projections.
Computes ROC curves for detector performance evaluation.
Thanks to the permissive license of this toolbox, several derivative works have emerged:
Much of this codebase has been ported to Python in the PySPTools project, providing these algorithms to the Python community.
David Kun's fork of this toolbox maintains the MATLAB implementation while adding several new features.
Future development priorities include:
- Joint Affine Matched Filter
- Enhanced Matched Filter with signature statistics
- RAF-SAM (Improved Spectral Angle Mapper)
- ELM (Empirical Line Method) for radiance-to-reflectance conversion
- Advanced covariance matrix inversion methods
- Quadratic Detector
- Additional unmixing algorithms (SMACC, AMEE, NFINDR)
- Antonia Plaza's FastPPI
- Joshua Broaderwater's hybrid detectors
If you use this toolbox in your research, please cite:
@Misc{matlab_hsi_toolbox,
author = {Isaac Gerg},
title = {Open Source MATLAB Hyperspectral Toolbox},
howpublished = {\url{https://github.com/isaacgerg/matlabHyperspectralToolbox}},
year = {2006--2022}
}
Derivative works must include the original citation. New contributors should add their names to the author line while maintaining the original author information.
Email: [email protected]