unmix: Unmix spectra

View source: R/unmix.R

unmixR Documentation

Unmix spectra


Perform linear spectral unmixing on hyperspectral data or spectra resampled to satellite bands using endmember spectra.


unmix(spectra, endmember, returnHCR = "auto", scale = FALSE, ...)



Input spectra of class 'Speclib'


Endmember spectra of class 'Speclib'


Set class of value. If TRUE, value will be of class 'HyperSpecRaster', otherwise a list is returned. If auto, function will switch to mode depending on input data characteristics.


Flag to scale spectra to [0,1] if necessary.


Further arguments passed to HyperSpecRaster (ignored if returnHCR = FALSE).


Linear spectral unmixing is a frequently used method to calculate fractions of land-cover classes (endmembers) within the footprint of pixels. This approach has originally been intended to be used for multispectral satellite images. The basic assumption is that the signal received at the sensor (p_{mix}) is a linear combination of n pure endmember signals (p_i) and their cover fractions (f_i):

p_{mix} = ∑^{n}_{i=1} p_i f_i,

where f_1, f_2 , ..., f_n >= 0 and ∑^{n}_{i=1} f_i = 1 to fulfill two constraints:

  1. All fractions must be greater or equal 0

  2. The sum of all fractions must be 1

Since this linear equation system is usually over-determined, a least square solution is performed. The error between the final approximation and the observed pixel vector is returned as vector (error) in list (returnSpatialGrid = FALSE) or as last band if returnSpatialGrid = TRUE.


A list containing the fraction of each endmember in each spectrum and an error value giving the euclidean norm of the error vector after least square error minimisation.


Unmixing code is based on "i.spec.unmix" for GRASS 5 written by Markus Neteler (1999).


Lukas Lehnert


Sohn, Y. S. & McCoy, R. M. (1997): Mapping desert shrub rangeland using spectral unmixing and modeling spectral mixtures with TM data. Photogrammetric Engineering and Remote Sensing, 63, 707-716


## Not run: 
## Use PROSAIL to generate some vegetation spectra with different LAI
parameter <- data.frame(LAI = seq(0, 1, 0.01))
spectral_data <- PROSAIL(parameterList = parameter)

## Get endmember spectra
## Retrieve all available spectra
avl <- USGS_get_available_files()

## Download all spectra matching "grass-fescue"
grass_spectra <- USGS_retrieve_files(avl = avl, pattern = "grass-fescue")
limestone <- USGS_retrieve_files(avl = avl, pattern = "limestone")

## Integrate all spectra to Quickbird
grass_spectra_qb <- spectralResampling(grass_spectra[1,], "Quickbird")
limestone_qb <- spectralResampling(limestone, "Quickbird")
spectral_data_qb <- spectralResampling(spectral_data, "Quickbird")

em <- speclib(spectra = rbind(spectra(grass_spectra_qb), 
              wavelength = wavelength(limestone_qb))

## Unmix
unmix_res <- unmix(spectral_data_qb, em)


plot(unmix_res$fractions[1,] ~ SI(spectral_data_qb)$LAI, type = "l",
     xlab = "LAI", ylab = "Unmixed fraction of vegetation")

## End(Not run)

hsdar documentation built on March 18, 2022, 6:35 p.m.