Identifying and upscaling vegetation endmembers from UAV imagery to estimate vegetation diversity at larger scale applications in Software Development course.

Linear Spectral Mixture Analysis (LSMA)

You can access the Github repository HERE.


Linear Spectral Mixture Analysis (LSMA) is a popular technique in remote sensing that aims to decompose mixed pixel spectra into their constituent endmembers. It involves automatically extracting the endmembers and estimating both their abundance fractions and spectral signatures simultaneously. LSMA assumes a linear mixture model and solves an optimization problem to find the best fit between the observed spectra and the linear combination of endmember spectra weighted by their abundance fractions. The outputs of LSMA include abundance maps and the estimated endmember spectra, providing valuable information about the spatial distribution and composition of materials in the scene.


Using Jupyter Notebook, series of steps were taken, as follow:
- Import necessary libraries required for data manipulation, image processing, visualization, and spectral unmixing;
- UAV image preprocessing: loading the image as 3D NumPy array, checking the presence of no data values in the image, creating mask of locations where the image has no data values, normilising the image values between 0 and 1, calculating the Normalized Difference Vegetation Index (NDVI) and applies a threshold to create a mask for vegetation areas, performing dimensionality reduction using the Minimum Noise Fraction (MNF) transformation on the masked and normalized image;
- Endmember extraction: extracting the endmembers, which represent the pure spectral signatures of different vegetation types, using the Pixel Purity Index (FIPPI) algorithm to extract potential endmembers from the MNF-transformed image, and converting them to geographic coordinates;
- Endmember selection with Graham's scan: This section further refines the selection of endmembers using Graham's Scan algorithm and a convex hull. It loads potential endmembers that were previously selected in QGIS. It flattens the endmember dictionary into a list of coordinates. It retrieves the MNF spectra for each potential endmember. It applies Graham's Scan algorithm to find the endmembers within the convex hull. The resulting endmembers are plotted in the feature space;
- Applying the LSMA to the Sentinel-2 image: the LSMA algorithm is applied to a Sentinel-2 image to map the abundance of the selected endmembers in the image.