<< erode Image filtering morphologyEx >>

scicv >> Image filtering > filter2D

filter2D

Convolves an image with a kernel

Syntax

img_out = filter2D(img_in, depth, kernel[, anchor[, delta[, borderType]]])

Parameters

img_in

Input image (Mat).

depth

Depth of output image (double) (-1 specifies the output image has the same depth as the input image).

kernel

Convolution kernel (double matrix or Mat).

anchor

Position of the anchor in the element (double 1x2 matrix) (default the anchor is at the element center).

delta

Value added to the filtered pixels (double) (default 0).

borderType

Pixel extrapolation method (double) (default BORDER_DEFAULT).

img_out

Output image (Mat).

Description

filter2D convolves an image with a kernel.

Examples

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);

Report an issue
<< erode Image filtering morphologyEx >>