您的位置:首页 > 编程语言 > MATLAB

matlab边缘检测代码(包含roberts,sobel,prewitt三种算子)

2011-11-03 12:00 567 查看
代码

I=a;
BW1=edge(I,'roberts');
[BW1,thresh1]=edge(I,'roberts');
figure;
%subplot(1,2,1);
imshow(BW1);
BW1=edge(I,'roberts',0.05);
figure;
%subplot(1,2,2);
imshow(BW1);

BW2=edge(I,'sobel');
figure;
%subplot(1,3,1);
imshow(BW2);
[BW2,thresh2]=edge(I,'sobel');
BW2=edge(I,'roberts',0.05,'horizontal');
figure;
%subplot(1,3,2);
imshow(BW2);
BW2=edge(I,'roberts',0.05,'vertical');
%subplot(1,3,3);
imshow(BW2);

BW3=edge(I,'prewitt');
figure;
subplot(1,3,1);imshow(BW3);
[BW3,thresh3]=edge(I,'prewitt');
BW3=edge(I,'roberts',0.05,'horizontal');
subplot(1,3,2);imshow(BW3);
BW3=edge(I,'prewitt',0.05,'vertical');
subplot(1,3,3);imshow(BW3);

效果如下
原图:



边缘检测:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  matlab