Compute the two-dimensional convolution of two matrices.
conv2(a, b, shape = c("full","same","valid"))
Arguments
a, b: Input matrices, coerced to numeric.
shape: Subsection of convolution, partially matched to:
"full": Return the full convolution (default)
"same": Return the central part of the convolution with the same size as A. The central part of the convolution begins at the indices floor(c(nrow(b), ncol(b)) / 2 + 1)
"valid": Return only the parts which do not include zero-padded edges. The size of the result is max(nrow(a) - nrow(a) + 1, 0) by max(ncol(A) - ncol(B) + 1, 0)
Returns
Convolution of input matrices, returned as a matrix.