matlab7.0中的edge函数总是报错,我的代码和错误提示信息如下,请大侠们帮帮忙

I=IMREAD('剪纸.jpg');I2=imnoise(I,'salt&pepper',0.3);%I3=imnoise(I,'gaussian',0,100);%加... I=IMREAD('剪纸.jpg');
I2=imnoise(I,'salt & pepper',0.3);
%I3=imnoise(I,'gaussian',0,100); %加均值为0,方差为100的高斯噪声
figure
subplot(1,2,1);imshow(I);title('灰白原图');
subplot(1,2,2);imshow(I2);title('加椒盐噪声的图像');
%subplot(1,3,3);imshow(I3);title('加椒盐和高斯噪声的图像');
%BJ2=edge(I2,'prewitt'); %prewitt图像边缘提取
BW2=edge(I,'prewitt');
figure
subplot(1,2,1);imshow(BW2);title('含噪图像边界');

运行后总提示
??? Error using ==> images\private\checkinput>check_attributes
Function EDGE expected its first input argument, I,
to be two-dimensional.
Error in ==> images\private\checkinput at 37
check_attributes(A, attributes, function_name, variable_name, ...

Error in ==> edge>parse_inputs at 502
checkinput(I,{'double','logical','uint8','uint16'},...

Error in ==> edge at 161
[a,method,thresh,sigma,H,kx,ky] = parse_inputs(varargin{:});
展开
 我来答
晴雨潋滟
推荐于2017-09-16
知道答主
回答量:21
采纳率:0%
帮助的人:17.5万
展开全部
报错信息说了,你要把图像变成灰度图像。
I=imread('剪纸.jpg');
I=rgb2gray(I);
I2=imnoise(I,'salt & pepper',0.3);
%I3=imnoise(I,'gaussian',0,100); %加均值为0,方差为100的高斯噪声
figure
subplot(1,2,1);imshow(I);title('灰白原图');
subplot(1,2,2);imshow(I2);title('加椒盐噪声的图像');
%subplot(1,3,3);imshow(I3);title('加椒盐和高斯噪声的图像');
%BJ2=edge(I2,'prewitt'); %prewitt图像边缘提取
BW2=edge(I,'prewitt');
figure
subplot(1,2,1);imshow(BW2);title('含噪图像边界');
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式