roifilt2() - Image Processing
J = roifilt2(h, I, BW) filters
the data in I with the two-dimensional linear filter h. BW is
a binary image the same size as I that defines
an ROI used as a mask for filtering. roifilt2 returns
an image that consists of filtered values for pixels in locations
where BW contains 1's, and unfiltered values for
pixels in locations where BW contains 0's. For
this syntax, roifilt2 calls filter2 to
implement the filter.J = roifilt2(I, BW, fun) processes
the data in I using the function fun.
The result J contains computed values for pixels
in locations where BW contains 1's, and the actual
values in I for pixels in locations where BW contains
0's. fun must be a function handle. Parameterizing
Functions, in the MATLAB Mathematics documentation, explains how to
provide additional parameters to the function fun.
Syntax
J = roifilt2(h, I, BW)J = roifilt2(I, BW, fun)
Example
I = imread('eight.tif');
c = [222 272 300 270 221 194];
r = [21 21 75 121 121 75];
BW = roipoly(I,c,r);
H = fspecial('unsharp');
J = roifilt2(H,I,BW);
figure, imshow(I), figure, imshow(J)
Output / Return Value
Limitations
Alternatives / See Also
Reference