mesma | R Documentation |
mesma
performs a spectral mixture anlylsis (SMA) or multiple endmember spectral mixture analysis (MESMA) on a multiband raster image.
mesma(
img,
em,
method = "NNLS",
iterate = 400,
tolerance = 1e-08,
n_models = 5,
sum_to_one = TRUE,
...,
verbose
)
img |
SpatRaster. Remote sensing imagery (usually hyperspectral). |
em |
Matrix or data.frame with spectral endmembers. Columns represent the spectral bands (i.e. columns correspond to number of bands in |
method |
Character. Select an unmixing method. Currently, only "NNLS" is implemented. Default is "NNLS".
|
iterate |
Integer. Set maximum iteration per pixel. Processing time could increase the more iterations are made possible. Default is 400. |
tolerance |
Numeric. Tolerance limit representing a nearly zero minimal number. Default is 1e-8. |
n_models |
Logical. Only applies if |
sum_to_one |
Logical. Defines whether a sum-to-one constraint should be applied so that probabilities of endmember classes sum to one (a constraint not covered by NNLS) to be interpretable as fractions. Defaults to |
... |
further arguments passed to writeRaster. |
verbose |
Logical. Prints progress messages during execution. |
Argument em
determines whether an SMA (each row representing a single endmember per class) or a MESMA (multiple endmembers per class differentiate using the class
column) is computed.
If multiple endmembers per class are provided, mesma
will compute a number of SMA (determined by argument n_models
) for multiple endmember combinations drawn from em
and will select the best fit per pixel based on the lowest RMSE, based on the MESMA approach proposed by Roberts et al. (1998).
SpatRaster. The object will contain one band per class, with each value representing the estimated probability of the respective endmember class per pixel, and an RMSE band. If sum_to_one
is TRUE
(default), values of the class bands can be interpreted as fractions per endmember class (0 to 1).
Depending on iterate
and tolerance
settings and the selected endmembers, the sum of estimated probabilities per pixel varies around 1. NNLS does not account for a sum-to-one constraint. Use sum_to_one
to sum to one post-NNLS.
To achieve best results, it is recommended to adjust n_models
in accordance to the number of endemembers per class provided through em
so that as many endmember combinations as possible (with each endmember being used once) are computed. The more models are being calculated, the more processing and memory recourses are needed.
Jakob Schwalb-Willmann
Franc, V., Hlaváč, V., & Navara, M. (2005). Sequential coordinate-wise algorithm for the non-negative least squares problem. In: International Conference on Computer Analysis of Images and Patterns (pp. 407-414). Berlin, Heidelberg.
Roberts, D. A., Gardner, M., Church, R., Ustin, S., Scheer, G., & Green, R. O. (1998). Mapping chaparral in the Santa Monica Mountains using multiple endmember spectral mixture models. Remote sensing of environment, 65(3), 267-279.
library(RStoolbox)
library(terra)
# to perform a SMA, use a single endmember per class, row by row:
em <- data.frame(lsat[c(5294, 47916)])
rownames(em) <- c("forest", "water")
# umix the lsat image
probs <- mesma(img = lsat, em = em)
plot(probs)
# to perform a MESMA, use multiple endmembers per class, differntiating them
# by a column named 'class':
## Not run:
em <- rbind(
data.frame(lsat[c(4155, 17018, 53134, 69487, 83704)], class = "forest"),
data.frame(lsat[c(22742, 25946, 38617, 59632, 67313)], class = "water")
)
# unmix the lsat image
probs <- mesma(img = lsat, em = em)
plot(probs)
# MESMA can also be performed on more than two endmember classes:
em <- rbind(
data.frame(lsat[c(4155, 17018, 53134, 69487, 83704)], class = "forest"),
data.frame(lsat[c(22742, 25946, 38617, 59632, 67313)], class = "water"),
data.frame(lsat[c(4330, 1762, 1278, 1357, 17414)], class = "shortgrown")
)
# unmix the lsat image
probs <- mesma(img = lsat, em = em)
plot(probs)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.