Function File: J = imfilter(I, f)
Function File: J = imfilter(I, f, options, …)

Computes the linear filtering of the image I and the filter f. The computation is performed using double precision floating point numbers, but the class of the input image is preserved as the following example shows.

I = 255*ones(100, 100, "uint8");
f = fspecial("average", 3);
J = imfilter(I, f);
class(J)
⇒ ans = uint8

The function also accepts a number of optional arguments that control the details of the filtering. The following options is currently accepted

S

If a scalar input argument is given, the image is padded with this scalar as part of the filtering. The default value is 0.

"symmetric"

The image is padded symmetrically.

"replicate"

The image is padded using the border of the image.

"circular"

The image is padded by circular repeating of the image elements.

"same"

The size of the output image is the same as the input image. This is the default behaviour.

"full"

Returns the full filtering result.

"corr"

The filtering is performed using correlation. This is the default behaviour.

"conv"

The filtering is performed using convolution.

See also: conv2, filter2, fspecial, padarray.

Package: image