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

效果如下

原图:


边缘检测:


©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页