图像边缘检测,sobel,Roberts,Prewitt方法实验
clear
close
I=imread('C:\Users\lx\Desktop\test1.jpeg');
I=rgb2gray(I);
subplot(221);
imshow(I);
title('原始图像')
BW1=edge(I,'sobel');
subplot(222);imshow(BW1);
title('sobel');
BW2=edge(I,'Roberts');
subplot(223);imshow(BW2);
title('Roberts');
BW3=edge(I,'Prewitt');
subplot(224);imshow(BW3);
title('Prewitt');
set(gcf,'color','w') %设置背景色
实验结果