adapted from continuumRemoval function in R package propsectr https://github.com/l-ramirez-lopez/prospectr/blob/main/R/continuumRemoval.R
Compute the continuum removed values of a data matrix or vector
a numeric matrix or vector to process (optionally a data frame that can be coerced to a numerical matrix).
optional. A numeric vector of band positions.
the type of data: 'R' for reflectance (default), 'A' for absorbance.
the interpolation method between points on the convex hull: 'linear' (default) or 'spline'.
normalization method: 'division' (default) or 'subtraction' (see details section).
a matrix or vector with the filtered spectra.
The continuum removal technique was introduced by Clark and Roush (1984) as a method to highlight energy absorption features of minerals. It can be viewed as a way to perform albedo normalization. The algorithm find points lying on the convex hull (local maxima or envelope) of a spectrum, connects the points by linear or spline interpolation and normalizes the spectrum by dividing (or subtracting) the input data by the interpolated line.
Clark, R.N., and Roush, T.L., 1984. Reflectance Spectroscopy: Quantitative Analysis Techniques for Remote Sensing Applications. J. Geophys. Res. 89, 6329-6340.