roifilt2 在MATLAB中的用法
2017-11-17 11:18
344 查看
roifilt2
Filter region of interest (ROI) in image
collapse all in page
Syntax
J = roifilt2(h, I, BW)
J = roifilt2(I, BW, fun)
Description
J = roifilt2(h, I, BW) filtersthe data in I with the two-dimensional linear filter h. BW isa binary image the same size as I that definesan ROI used as a mask for filtering. roifilt2 returnsan image that consists of filtered values for pixels in locationswhere
BW contains 1's, and unfiltered values forpixels in locations where BW contains 0's. Forthis syntax, roifilt2 calls filter2 toimplement the filter.
J = roifilt2(I, BW, fun) processesthe data in I using the function fun.The result J contains computed values for pixelsin locations where BW contains 1's, and the actualvalues in I for pixels in locations where BW contains0's. fun must be a functionhandle.
Parameterizing Functions,in the MATLAB Mathematics documentation, explains how to provide additionalparameters to the function fun.
Class Support
For the syntax that includes a filter h,the input image can be logical or numeric, and the output array J hasthe same class as the input image. For the syntax that includes afunction, I can be of any class supported by fun,and the class of J depends on the
class of theoutput from fun.
Examples
This example continues the roipoly example,filtering the region of the image I specified bythe mask BW. The roifilt2 functionreturns the filtered image J, shown in the followingfigure.
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)
Filter region of interest (ROI) in image
collapse all in page
Syntax
J = roifilt2(h, I, BW)
J = roifilt2(I, BW, fun)
Description
J = roifilt2(h, I, BW) filtersthe data in I with the two-dimensional linear filter h. BW isa binary image the same size as I that definesan ROI used as a mask for filtering. roifilt2 returnsan image that consists of filtered values for pixels in locationswhere
BW contains 1's, and unfiltered values forpixels in locations where BW contains 0's. Forthis syntax, roifilt2 calls filter2 toimplement the filter.
J = roifilt2(I, BW, fun) processesthe data in I using the function fun.The result J contains computed values for pixelsin locations where BW contains 1's, and the actualvalues in I for pixels in locations where BW contains0's. fun must be a functionhandle.
Parameterizing Functions,in the MATLAB Mathematics documentation, explains how to provide additionalparameters to the function fun.
Class Support
For the syntax that includes a filter h,the input image can be logical or numeric, and the output array J hasthe same class as the input image. For the syntax that includes afunction, I can be of any class supported by fun,and the class of J depends on the
class of theoutput from fun.
Examples
This example continues the roipoly example,filtering the region of the image I specified bythe mask BW. The roifilt2 functionreturns the filtered image J, shown in the followingfigure.
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)
相关文章推荐
- MATLAB中的S-Function的用法(C语言)
- matlab 函数meshgrid的用法(生成网格矩阵)
- 初步体验libsvm用法(matlab2012)
- matlab 中的 S-Function的用法(C语言)
- matlab中Svmtrain和Svmpredict的用法
- Matlab的imfilter函数用法
- MATLAB中find函数用法
- matlab几种括号的用法
- MATLAB中随机数产生中的"state", "seed", "twister"用法
- 【matlab】global的用法
- Matlab学习第二天 插值的用法
- Matlab 的fspecial函数用法 -滤波
- 初步体验libsvm用法3(matlab实例)
- matlab中im2bw函数的用法
- MATLAB中cell函数用法
- MATLAB中的S-Function的用法(C语言)
- plot函数用法(MATLAB)
- matlab中chol函数用法
- matlab中fopen函数与fprintf用法
- matlab 中eps的用法