
Last chance! 50% off unlimited learning
Sale ends in
matrix
or array
object type.
applyFilter(x, kernel)
matrix
or array
matrix
containing the values chosen as convolution kernelx
containing data processed by convolution kernel
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.
## 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**)
Run the code above in your browser using DataLab