声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2481|回复: 1

[图像处理] 菜鸟请教问题:imhist(),edge()等函数不能用

[复制链接]
发表于 2006-5-25 17:11 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
<P>&gt;&gt; figure,imhist(i);<BR>??? Error using ==&gt; e:/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 ==&gt; E:\matlab\toolbox\images\images\private\checkinput.m<BR>On line 37  ==&gt; check_attributes(A, attributes, function_name, variable_name, ...</P>
<P>Error in ==&gt; E:\matlab\toolbox\images\images\imhist.m (parse_inputs)<BR>On line 173  ==&gt; checkinput(a, 'double uint8 logical uint16', '2d', mfilename, 'I or X', 1);</P>
<P>Error in ==&gt; E:\matlab\toolbox\images\images\imhist.m<BR>On line 49  ==&gt; [a, n, isScaled, top, map] = parse_inputs(varargin{:});<BR>输入上述命令后,出现错误,我看不懂,不知道为什么不能用,是不是我的MATLAB程序缺失?<BR>edge()函数同样出现类似错误无法使用,<BR>请教各位朋友!</P>
回复
分享到:

使用道具 举报

发表于 2007-11-1 17:40 | 显示全部楼层
Solution:This is the expected behavior of IMHIST. According to the documentation, IMHIST was never meant to accept RGB images. However, in versions of the Image Processing Toolbox prior to 3.2 (R13), IMHIST would follow through execution without erroring out. The results would most likely not be the desired results. IMHIST R13 now errors out so that you won't receive erroneous results.

In order to fix the problem, you will need to read the documentation on IMHIST and understand the image types that it supports. You will basically need to convert your RGB image into a grayscale or indexed image.



For a simple example, you can use the following code as a guide:


% Read in RGB image
rgb = imread('flowers.tif');

% Convert RGB to grayscale
gray = rgb2gray(rgb);

% Now call IMHIST
figure;
imhist(gray)
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-23 21:24 , Processed in 0.053447 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表