Description Usage Arguments Details Value Examples
This function applies the a convolution kernel based filter to a matrix
or array
object type.
1 | applyFilter(x, kernel)
|
x |
An object of class |
kernel |
A |
The application of a convolution kernel over a 2D matrix dataset allows to apply functions as smoothing or edge detection.
The aim of this function is to filter 2D matrices in order to help signal finding across (images-derived) data. It is also possible to
filter 3D arrays considering them as slices of a series of images to be processed. Higher dimensions arrays are not allowed.
The kernel
parameter is a simple square matrix with an odd number of rows/columns, that can be pre-calculated by using
the function convKernel
. Not square matrices or matrices with even number of rows/columns will exit an error.
An object with the same size of x
containing data processed by convolution kernel
1 2 3 4 5 6 7 8 9 10 11 12 | ## Not run:
M <- array(runif(1000000), dim = c(100,100,100))
# smooth the array M
Mfil <- applyFilter(x = M, kernel = convKernel(sigma = 1.4, k = 'gaussian'))
image(M[,,50], col = grey(1:1000/1000))
image(Mfil[,,50], col = grey(1:1000/1000))
# now combining two filters in cascade
Mfil <- applyFilter(x = applyFilter(x = M, kernel = convKernel(k = 'sobel')),
kernel = convKernel(sigma = 1.4, k = 'gaussian'))
image(Mfil[,,50], col = grey(1:1000/1000))
## End(**Not run**)
|
Loading required package: abind
Loading required package: fields
Loading required package: spam
Loading required package: dotCall64
Loading required package: grid
Spam version 2.2-2 (2019-03-07) is loaded.
Type 'help( Spam)' or 'demo( spam)' for a short introduction
and overview of this package.
Help for individual functions is also obtained by adding the
suffix '.spam' to the function name, e.g. 'help( chol.spam)'.
Attaching package: 'spam'
The following objects are masked from 'package:base':
backsolve, forwardsolve
Loading required package: maps
See https://github.com/NCAR/Fields for
an extensive vignette, other supplements and source code
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.