`
lovnet
  • 浏览: 6704619 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
文章分类
社区版块
存档分类
最新评论

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

 
阅读更多

代码

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);

效果如下

原图:


边缘检测:


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics