Learn R Programming

hsdar (version 0.5.1)

unmix: Unmix spectra

Description

Unmix spectra or spectra resampled to satellite bands using endmember spectra

Usage

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

Arguments

spectra
Input spectra of class 'speclib'
endmember
Endmember spectra of class 'speclib'
returnHCR
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.
scale
Flag to scale spectra to [0,1] if necessary.
...
Further arguments passed to HyperSpecRaster (ignored if returnHCR = FALSE).

Value

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.

Details

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$): $$ \rho_{mix} = \sum^{n}_{i=1} \rho_i f_i, $$ where $f_1, f_2 , ..., f_n >= 0$ and $\sum^{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.

References

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

Examples

Run this code
## 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), 
#                               spectra(limestone_qb))/100,
#               wavelength = wavelength(limestone_qb))
# 
# ## Unmix
# unmix_res <- unmix(spectral_data_qb, em)
# 
# unmix_res
# 
# plot(unmix_res$fractions[1,] ~ attribute(spectral_data_qb)$LAI, type = "l",
#      xlab = "LAI", ylab = "Unmixed fraction of vegetation")
# ## End(Not run)

Run the code above in your browser using DataLab