%[filename,pathname]=uigetfile({'*.jpg';'*bmp';'*gif'},'选择原图片');
%I = imread([pathname,filename]);
f = imread('3.png');
I=rgb2gray(f);
%五种边缘检测
figure('Name','进行五种边缘检测');
subplot(2,3,1);
imshow(I);
title('原图');
%BW1=edge(I,'Roberts',0.16);
%subplot(2,3,2);
%imshow(BW1);
%title('Robert算子边缘检测')
%BW2=edge(I,'Sobel',0.16);
%subplot(2,3,3);
%imshow(BW2);
%title('Sobel算子边缘检测')
BW3=edge(I,'Prewitt',0.06);
subplot(2,3,4);
imshow(BW3);
title('Prewitt算子边缘检测');
%BW4=edge(I,'LOG',0.012);
%subplot(2,3,5);
%imshow(BW4);
%title('LOG算子边缘检测')
BW5=edge(I,'Canny',0.35);
subplot(2,3,6);
imshow(BW5);
title('Canny算子边缘检测')