Convolve image by filter.

Description

The result res of the convolution of an image img by filter flt is defined to be: res(x,y,z) = sum_{i,j,k} img(x-i,y-j,z-k)*flt(i,j,k)

Usage

1
convolve(im, filter, dirichlet = FALSE, normalise = FALSE)

Arguments

im

an image

filter

a filter (another image)

dirichlet

boundary condition (FALSE=zero padding, TRUE=dirichlet). Default FALSE

normalise

normalise filter (default FALSE)

See Also

correlate

Examples

1
2
3
4
5
6
#Edge filter
filter <- as.cimg(function(x,y) sign(x-5),10,10) 
layout(t(1:2))
#Convolution vs. correlation 
correlate(boats,filter) %>% plot(main="Correlation")
convolve(boats,filter) %>% plot(main="Convolution")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.