代码
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);
原图:
边缘检测: