1. 程式人生 > >邊緣檢測-matlab

邊緣檢測-matlab

matlab

I = imread('yourimage');
I = rgb2gray(I);
%五種邊緣檢測
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運算元邊緣檢測') % H_gray = rgb2gray(H); % imshow(H_gray)