matlab中的edge函数入口参数如何设置?

[复制链接]
查看11 | 回复3 | 2017-8-6 10:53:38 | 显示全部楼层 |阅读模式
如果一个图本身就是黑白的用不用在转换成二维灰度图?
出错的程序如下:
>> I = 'D:\abc.jpg'
I =
D:\abc.jpg
>> [BW,thresh] = edge(I,'canny');
% 返回当前Canny算子边缘检测的阈值
disp('Canny算子自动选择的阈值为:')
disp(thresh)
subplot(121),imshow(BW);
title('自动阈值的Canny算子边缘检测')
BW = edge(I,'Canny',[0.2 0.5]);
% 以阈值为[0.1 0.5]对图像进行Canny算子检测
subplot(122),imshow(BW);
title('阈值为[0.1 0.5]的Canny算子边缘检测')
??? Error using ==> iptcheckinput
Function EDGE expected its first input, I,
to be one of these types:
double, single, uint8, uint16, uint32, int8, int16, int32, logical
Instead its type was char.
Error in ==> edge>parse_inputs at 541
iptcheckinput(I,{'numeric','logical'},{'nonsparse','2d'},mfilename,'I',1);
Error in ==> edge at 197
[a,method,thresh,sigma,thinning,H,kx,ky] = parse_inputs(varargin{:});
恳请路过的大侠帮忙

回复

使用道具 举报

千问 | 2017-8-6 10:53:38 | 显示全部楼层
这种情况下建议用bwperim来提取边缘...
回复

使用道具 举报

千问 | 2017-8-6 10:53:38 | 显示全部楼层
I= imread('D:\abc.jpg'); %读入图像...
回复

使用道具 举报

千问 | 2017-8-6 10:53:38 | 显示全部楼层
底下不是有错误分析嘛。要将数据格式转化为double, single, uint8, uint16, uint32, int8, int16, int32, logical这几种类型。...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行