www.gusucode.com > images 案例代码 matlab源码程序 > images/CompareEdgeDetectionUsingCannyAndPrewittMethodsExample.m

    %% Compare Edge Detection Using Canny and Prewitt Methods
% 
%% 
% Read a grayscale image into the workspace and display it.

% Copyright 2015 The MathWorks, Inc.

I = imread('circuit.tif');
imshow(I)
%%
% Find edges using the Canny method.
BW1 = edge(I,'Canny');
%%
% Find edges using the Prewitt method.
BW2 = edge(I,'Prewitt');
%%
% Display both results side-by-side.
imshowpair(BW1,BW2,'montage')