noiseFiltering | R Documentation |
Smoothing of spectral data by Savitzky-Golay, lowess, spline, mean or user-defined filtering approaches.
noiseFiltering(x, method = "mean", ...)
x |
Object of class |
method |
Character string giving the name of the method to be used. Predefined valid options are "sgolay", "lowess", "spline" and "mean". However, method can also be the (character) name of any other filter function (see examples). |
... |
Further arguments passed to the filter functions. The following arguments are important for the predefined methods:
Refer to the links in the details section, and see examples. |
Smoothing of spectra by filtering approaches is an essential technique in pre-processing of hyperspectral data with its contiguous spectra. By stepwise fitting of the spectral channels within a defined window size, it is used to minimize the variances caused by intrumental variations or the high noise levels resulting from the very fine wavelength resolution. Therefore, this function allows filtering using four different methods:
Savitzky-Golay: Smoothing applying Savitzky-Golay-Filter. See sgolayfilt
from signal-package for details.
Lowess: Smoothing applying lowess-Filter. See lowess
from stats-package for details.
Spline: Smoothing applying spline-Filter. See spline
from stats-package for details.
Mean: Smoothing applying mean-Filter. See meanfilter
for details.
Object of class Speclib
.
Lukas Lehnert, Wolfgang Obermeier
Tsai, F. & Philpot, W. (1998): Derivative analysis of hyperspectral data. Remote Sensing of Environment 66/1. 41-51.
Vidal, M. & Amigo, J. (2012): Pre-processing of hyperspectral images. Essential steps before image analysis. Chemometrics and Intelligent Laboratory Systems 117. 138-148.
sgolayfilt
, lowess
, spline
, meanfilter
data(spectral_data) ## Example of predefined filter functions ## Savitzky-Golay sgolay <- noiseFiltering(spectral_data, method="sgolay", n=25) ## Spline spline <- noiseFiltering(spectral_data, method="spline", n=round(nbands(spectral_data)/10,0)) ## Lowess lowess <- noiseFiltering(spectral_data, method="lowess", f=.01) ## Mean meanflt <- noiseFiltering(spectral_data, method="mean", p=5) par(mfrow=c(2,2)) plot(spectral_data, FUN=1, main="Savitzky-Golay") plot(sgolay, FUN=1, new=FALSE, col="red", lty="dotted") plot(spectral_data, FUN=1, main="Spline") plot(spline, FUN=1, new=FALSE, col="red", lty="dotted") plot(spectral_data, FUN=1, main="Lowess") plot(lowess, FUN=1, new=FALSE, col="red", lty="dotted") plot(spectral_data, FUN=1, main="Mean") plot(meanflt, FUN=1, new=FALSE, col="red", lty="dotted") ## Example of a not predefined filter function (Butterworth filter) bf <- butter(3, 0.1) bf_spec <- noiseFiltering(spectral_data, method="filter", filt=bf) plot(spectral_data, FUN=1, main="Butterworth filter") plot(bf_spec, FUN=1, new=FALSE, col="red", lty="dotted")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.