在Matlab图像处理中遇到的问题
<P>请师兄师姐帮忙一下:(想得到原始图像的原始直方图)<BR>运行下面程序<BR>I=imread('H:\10.jpg');<BR>imshow(I)<BR>figure,imhist(I,64)<BR>命令窗口就出现下面的提示:<BR><BR>??? Error using ==> g:/matlab/toolbox/images/images/private/checkinput (check_attributes)<BR>Function imhist expected its first input argument, I or X,<BR>to be two-dimensional.</P><P>Error in ==> G:\Matlab\toolbox\images\images\private\checkinput.m<BR>On line 37==> check_attributes(A, attributes, function_name, variable_name, ...</P>
<P>Error in ==> G:\Matlab\toolbox\images\images\imhist.m (parse_inputs)<BR>On line 173==> checkinput(a, 'double uint8 logical uint16', '2d', mfilename, 'I or X', 1);</P>
<P>Error in ==> G:\Matlab\toolbox\images\images\imhist.m<BR>On line 49==> = parse_inputs(varargin{:});<BR><BR>请问这要怎么解决呢?谢谢~!</P> <P>你的.jpg是应该是彩色图像吧,那应该不是2维的吧,好象只有灰度图像才有直方图啊!</P>
回复:(deany)在Matlab图像处理中遇到的问题
<P>你看看用imread得到I是不是三维的<BR>三维的不能用imhist ,你按楼上说的办就行了。</P><P>两种办法:<BR>1.转为灰度图<BR>J = gray(I)<BR>imhist(J);</P>
<P>2.</P>
<P>imhist(I(:,:,1)); % imhist of red component.<BR>imhist(I(:,:,2)); % imhist of green component.<BR>imhist(I(:,:,3)); % imhist of blue component. </P>
页:
[1]