clc
clear allI=imread('1.jpg');
I0=rgb2gray(I);
subplot(221);
imshow(I);
title('原图');
threshold = 0.3;
% BW1=edge(I0,'Roberts',threshold);
% subplot(232);
% imshow(BW1);
% title('Robert算子边缘检测')
BW2=edge(I0,'Sobel',threshold);
subplot(222);
imshow(BW2);
title('Sobel算子边缘检测')
BW3=edge(I0,'Prewitt',threshold);
subplot(223);
imshow(BW3);
title('Prewitt算子边缘检测');
% BW4=edge(I0,'LOG',threshold);
% subplot(235);
% imshow(BW4);
% title('LOG算子边缘检测')
BW5=edge(I0,'Canny',threshold);
subplot(224);
imshow(BW5);
title('Canny算子边缘检测')