meanfilter: Apply mean filter

Description Usage Arguments Value Author(s) See Also Examples

View source: R/speclib_smooth.R

Description

Apply mean filter to spectra. Filter size is passed as number of bands averaged at both sides of the respective band value.

Usage

1

Arguments

spectra

Data.frame, matrix or Speclib containing spectra

p

Filter size.

Value

Filtered matrix or Speclib of same dimension as input matrix/Speclib

Author(s)

Lukas Lehnert

See Also

noiseFiltering

Examples

1
2
3
4
5
6
7
data(spectral_data)

spectra_filtered <- meanfilter(spectral_data, p = 10)
plot(spectra_filtered[1,])
plot(spectral_data[1,], new = FALSE)

  

Example output

Loading required package: raster
Loading required package: sp
Loading required package: rgdal
rgdal: version: 1.5-18, (SVN revision 1082)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 3.0.4, released 2020/01/28
Path to GDAL shared files: /usr/share/gdal
GDAL binary built with GEOS: TRUE 
Loaded PROJ runtime: Rel. 6.3.1, February 10th, 2020, [PJ_VERSION: 631]
Path to PROJ shared files: /usr/share/proj
Linking to sp version:1.4-4
To mute warnings of possible GDAL/OSR exportToProj4() degradation,
use options("rgdal_show_exportToProj4_warnings"="none") before loading rgdal.
Loading required package: signal

Attaching package:signalThe following object is masked frompackage:raster:

    resample

The following objects are masked frompackage:stats:

    filter, poly

Loading required package: caret
Loading required package: lattice
Loading required package: ggplot2
Loading required package: Boruta

###################################
  This is hsdar 1.0.3
  To get citation entry type
      'citation("hsdar")'
###################################

Attaching package:hsdarThe following object is masked frompackage:raster:

    nbands

hsdar documentation built on Aug. 4, 2020, 5:06 p.m.