www.pudn.com > edgeExtraction.rar > demo.m, change:2012-06-20,size:699b


A = imread('lena.jpg'); 
B = double(A); 
meanImg = (B(:,:,1)+B(:,:,2)+B(:,:,3))/3; 
subplot(2,4,1);imshow(A);title('原图像'); 
 
robertImg1 = edge(meanImg,'roberts'); 
prewittImg1 = edge(meanImg,'prewitt'); 
sobelImg1 = edge(meanImg,'sobel'); 
subplot(2,4,2);imshow(robertImg1);title('matlab函数roberts'); 
subplot(2,4,3);imshow(prewittImg1);title('matlab函数prewitt'); 
subplot(2,4,4);imshow(sobelImg1);title('matlab函数sobel'); 
 
robertImg2 = robertEdge(A); 
prewittImg2 = prewittEdge(A); 
sobelImg2 = sobelEdge(A); 
subplot(2,4,6);imshow(robertImg2);title('自写函数roberts'); 
subplot(2,4,7);imshow(prewittImg2);title('自写函数prewitt'); 
subplot(2,4,8);imshow(sobelImg2);title('自写函数sobel');