dist.speclib | R Documentation |

Calculation of distance matrices by using one of the various distance measure to compute the distances between the spectra in `Speclib`

. Spectral Angle Mapper (SAM) is calculated with `sam`

giving reference spectra or with `sam_distance`

taking all combinations between spectra in single Speclib into account.

dist.speclib(x, method = "sam", ...) ## Direct call to Spectral Angle Mapper function sam(x, ref) sam_distance(x)

`x` |
Object of class |

`method` |
The distance measure to be used. This must be one of "sam", "euclidean", "maximum", "manhattan", "canberra", "binary" or "minkowski". |

`ref` |
Object of class |

`...` |
Further arguments, passed to other methods. |

Available distance measures are "spectral angle mapper" (`sam`

, Kruse et al. 1993) and all distance measures available in `dist`

. Spectral angle mapper is calculated with the following formula:

*
\cos^{-1}(∑_{i=1}^{nb}{t_i r_i} ∑_{i=1}^{nb}{t_i^2}^{-0.5} ∑_{i=1}^{nb}{r_i^2}^{-0.5})*

*nb* is the number of bands in Speclib. *t_i* and *r_i* are the reflectances of target and reference spectrum in band *i*, respectively.

The `dist-method`

for Speclibs returns an object of class `"dist"`

. See `dist`

for further information on class `"dist"`

. Both other functions return an object of class matrix.

Lukas Lehnert

Kruse, F. A.; Lefkoff, A. B.; Boardman, J. W.; Heidebrecht, K. B.; Shapiro, A. T.; Barloon, P. J. & Goetz, A. F. H. (1993). The spectral image processing system (SIPS) – interactive visualization and analysis of imaging spectrometer data. Remote Sensing of Environment, 44, 145-163.

`dist`

, `Speclib`

data(spectral_data) ## Mask channel crossing part (around 1050 nm) and strong ## water absorption part (above 1350 nm) mask(spectral_data) <- c(1045, 1055, 1350, 1706) ## Calculate distance between all spectra from spring ## using spectral angle mapper dist.speclib(subset(spectral_data, season == "spring")) ## Calculate spectral angle mapper between reference spectrum ## and spectral_data ## Use first spectrum from summer as reference distance <- sam(subset(spectral_data, season == "spring"), subset(spectral_data, season == "summer")[1,])

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.