分别采用roberts、sobel、prewitt、canny、log算子来检测图像的边缘并比较
I=imread('rice.png');
B1=edge(I,'roberts');
B2=edge(I,'sobel');
B3=edge(I,'prewitt');
B4=edge(I,'canny');
B5=edge(I,'log');
subplot(231),imshow(I),title('原始图像');
subplot(232),imshow(B1),title('roberts算子图像');
subplot(233),imshow(B2),title('sobel算子图像');
subplot(234),imshow(B3),title('prewitt算子图像');
subplot(235),imshow(B4),title('canny算子图像');
subplot(236),imshow(B5),title('log算子图像');
效果图如下: