关于matlab编程错误

运行:i1=imread('1.bmp') 这句运行正常 i2=histeq(i1) 后出现以下??? Error using ==> e:/matlab/toolbox/images/images/private/checkinput (check_attributes)Function imhist expected its first input argument, I or X,to be two-dimensional.Error in ==> E:\MATLAB\toolbox\images\images\private\checkinput.mOn line 37 ==> check_attributes(A, attributes, function_name, variable_name, ...Error in ==> E:\MATLAB\toolbox\images\images\imhist.m (parse_inputs)On line 173 ==> checkinput(a, 'double uint8 logical uint16', '2d', mfilename, 'I or X', 1);Error in ==> E:\MATLAB\toolbox\images\images\imhist.mOn line 49 ==> [a, n, isScaled, top, map] = parse_inputs(varargin{:});Error in ==> E:\MATLAB\toolbox\images\images\histeq.mOn line 131 ==> nn = imhist(a,n)';

是求直方图吧。
看这个行错误就知道。
Function imhist expected its first input argument, I or X,to be two-dimensional
imhist需要一个二维的输入参数。你直接读入的图片是不是二维的,你需要将其转换为二维图像。
我估计你读入的图像是彩色的,彩色图像不能那样直接做直方图的。
建议先将图像变为灰度图像。
i1 = rgb2gray(i1);
即可。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-05-31
你imread得到的i1是个三维RGB矩阵,是彩色图,要把它转化成灰度图才可以用histeq,可以写成:
i1=imread('1.bmp'); i2=rgb2gray(i1); i3=histeq(i2);
这样就对了
第2个回答  2012-05-31
disp('End'); 显示错误:??? Subscript indices must either be real nn=380/sqrt(3); Nph=3; poles=4; fe0=50; nn=1480; r1=1.03;X
相似回答