Extract averaged spectrum from hyperspectral raster
Source:R/hsi_extract_spectrum.R
hsi_extract_spectrum.RdAggregate a hyperspectral raster to a single spectrum representing the mean (or other summary) across all pixels. Useful for examining representative spectral signatures of regions of interest.
Arguments
- x
A
SpatRasterwith hyperspectral data. Band names must be numeric wavelengths in nm.- fun
Character. Aggregation function passed to
terra::aggregate(). Default"mean". Otherterrasummary functions are also supported.
Value
A tibble with columns:
- wavelength
Numeric. Wavelength in nm.
- value
Numeric. Aggregated reflectance value.
Details
Returns one value per wavelength band. To extract a spectrum from a
specific region, crop the raster first with terra::crop().
See also
hsi_extract_profile() for extracting values along a spatial axis.
Other HSI Extraction:
hsi_extract_profile()