imfilter函数叫做实现线性空间滤波函数。
中文名 imfilter函数
函数形式 B = IMFILTER(
外文名 imfilter
注意事项 To disable IPPL
imfilter函数解释:
IMFILTER N-D filtering of multidimensional images.
B = IMFILTER(A,H)filters the multidimensional array A with the
multidimensional filter H. A can be logical or it 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 or logical array, then output
elements that exceed the range of the given 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:
- Boundary options
X Input array values outside the bounds of the array
are implicitly assumed to have the value X. When no
boundary option is specified, IMFILTER uses X = 0.
'symmetric' Input array values outside the bounds of the array
are computed by mirror-reflecting the array across
the array border.
'replicate' Input array values outside the bounds of the array
are assumed to equal the nearest array border
value.
'circular' Input array values outside the bounds of the array
are computed by implicitly assuming the input array
is periodic.
- Output size options
(Output size options for IMFILTER are analogous to the SHAPE option
in the functions CONV2 and FILTER2.)
'same' The output array is the same size as the input
array. This is the default behavior when no output
size options are specified.
'full' The output array is the full filtered result, and so
is larger than the input array.
- Correlation and convolution
'corr' IMFILTER performs multidimensional filtering using
correlation, which is the same way that FILTER2
performs filtering. When no correlation or
convolution option is specified, IMFILTER uses
correlation.
'conv' IMFILTER performs multidimensional filtering using
convolution.
注意事项
Notes
-----
On some Intel Architecture processors, IMFILTER can take advantage of the
Intel Performance Primitives Library (IPPL), thus accelerating its execution
time. IPPL is activated only if A and H are both two dimensional and A is
uint8, int16 or single.
When IPPL is used, imfilter has different rounding behavior on some
processors. Normally, when A is an integer class, filter outputs such as
1.5, 4.5, etc., are rounded away from zero. However, when IPPL is used,
these values are rounded toward zero. This behavior may change in a future
release.
To disable IPPL, use this command:
iptsetpref('UseIPPL',false)
举例
Example
-------------
originalRGB = imread('peppers.png');
h = fspecial('motion',50,45);
filteredRGB = imfilter(originalRGB,h);
figure, imshow(originalRGB), figure, imshow(filteredRGB)
boundaryReplicateRGB = imfilter(originalRGB,h,'replicate');
figure, imshow(boundaryReplicateRGB)