当我在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');
怎么了?
答案 0 :(得分:3)
我无法在此测试,但如果我能够正确回想起nlfilter的参数必须是灰度图像,并且你传递的参数可能是rgb。
尝试:
I=imread('f:\oli.tif');
I2=nlfilter(rgb2gray(I),[3 3],'std2');
imshow(I2)