| Image Processing Toolbox | Search  Help Desk |
| roifilt2 | Examples See Also |
Syntax
J = roifilt2(h,I,BW)
J = roifilt2(I,BW,fun)
J = roifilt2(I,BW,fun,P1,P2,...)
Description
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 is 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 can be a string containing the name of a function, a string containing an expression, or an inline function object. fun should take a matrix as a single argument and return a matrix of the same size:
y =fun(x)
J = roifilt2(I,BW,fun,P1,P2,...) passes the additional parameters P1,P2,..., to fun.
Class Support
For the syntax that includes a filterh, the input image I can be of class uint8, uint16, or double, and the output array J is of class double. For the syntax that includes a function, I can be of any class supported by fun, and the class of J depends on the class of the output from fun.
Example
This example continues theroipoly example.
h = fspecial('unsharp');
J = roifilt2(h,I,BW);
imshow(J)

See Also
filter2, roipoly