Image Processing Toolbox | ![]() ![]() |
Multidimensional image filtering
Syntax
Description
B = imfilter(A,H)
filters the multidimensional array A
with the multidimensional filter H
. The array, A,
can be a nonsparse numeric array of any class and dimension. The result, B
, has the same size and class as A
.
Each element of the output, B
, is computed using double-precision floating point. If A
is an integer array, then output elements that exceed the range of the integer type are truncated, and fractional values are rounded.
B = imfilter(A,H,option1,option2,...)
performs multidimensional filtering according to the specified options. Option arguments can have the following values.
N-D convolution is related to N-D correlation by a reflection of the filter matrix.
Examples
This example starts by reading an image of a bouquet of flowers into a three-dimensional array of uint8
values, called rgb
. The imshow
function displays the original image, entitled 'Original'
.
Create a filter, h
, that can be used to approximate linear camera motion. Use imfilter
on the three-dimensional RGB image, rgb
, to create a new image, rgb2
.
Note that imfilter
is more memory efficient than some other filtering operations in that it outputs an array of the same data type as the input image array. In this example, the output is an array of uint8
.
Filter the image once more, this time specifying the replicate
boundary option and observe that the picture now extends to the border.
rgb3 = imfilter(rgb, h, 'replicate'); figure, imshow(rgb3), title('Filtered with boundary replication')
See Also
![]() | imfill | imfinfo | ![]() |