函数NLFILTER期望它的第一个输入A是二维的

时间:2012-03-16 20:21:53

标签: image matlab

当我在MATLAB(脚本)中编写这些代码时

I=imread('f:\oli.tif');
I2=nlfilter(I,[3 3],'std2');
imshow(I2)

给出以下错误:

Error using iptcheckinput
Function NLFILTER expected its first input, A, to be two-dimensional.

Error in nlfilter>parse_inputs (line 134)
iptcheckinput(a,{'logical','numeric'},{'2d'},mfilename,'A',1);

Error in nlfilter (line 51)
[a, nhood, fun, params, padval] = parse_inputs(varargin{:});

Error in Untitled21111111 (line 2)
I2=nlfilter(I,[3 3],'std2');

怎么了?

1 个答案:

答案 0 :(得分:3)

我无法在此测试,但如果我能够正确回想起nlfilter的参数必须是灰度图像,并且你传递的参数可能是rgb。

尝试:

I=imread('f:\oli.tif');
I2=nlfilter(rgb2gray(I),[3 3],'std2');
imshow(I2)