自定义函数:
function []=edge_detect(image_name)
a=imread(image_name);
I=rgb2gray(a); BW1=edge(I,'Roberts',0.16);
BW2=edge(I,'Sobel',0.16);
BW3=edge(I,'Prewitt',0.06);
BW4=edge(I,'LOG',0.012);
BW5=edge(I,'Canny',0.12); figure('Name','进行五种边缘检测');
subplot(,,);imshow(I);title('原图');
subplot(,,);imshow(BW1);title('Robert算子边缘检测')
subplot(,,);imshow(BW2);title('Sobel算子边缘检测')
subplot(,,);imshow(BW3);title('Prewitt算子边缘检测');
subplot(,,);imshow(BW4);title('LOG算子边缘检测');
subplot(,,);imshow(BW5);title('Canny边缘检测');