Convolves an image with a kernel
img_out = filter2D(img_in, depth, kernel[, anchor[, delta[, borderType]]])
Input image (Mat).
Depth of output image (double) (-1 specifies the output image has the same depth as the input image).
Convolution kernel (double matrix or Mat).
Position of the anchor in the element (double 1x2 matrix) (default the anchor is at the element center).
Value added to the filtered pixels (double) (default 0
).
Pixel extrapolation method (double) (default BORDER_DEFAULT
).
Output image (Mat).
filter2D
convolves an image with a kernel.
scicv_Init(); img = imread(getSampleImage("lena.jpg")); // Blur filter blur_kernel = ones(5, 5) / 25; img_blur = filter2D(img, -1, blur_kernel); matplot(img_blur); delete_Mat(img); delete_Mat(img_blur); | ![]() | ![]() |