function [eout,thresh,gv_45,gh_135] = edge(varargin)
%EDGE Find edges in intensity image.
% EDGE takes an intensity or a binary image I as its input, and returns a
% binary image BW of the same size as I, with 1's where the function
% finds edges in I and 0's elsewhere.
%
% EDGE supports six different edge-finding methods:
%
% The Sobel method finds edges using the Sobel approximation to the
% derivative. It returns edges at those points where the gradient of
% I is maximum.
%
% The Prewitt method finds edges using the Prewitt approximation to
% the derivative. It returns edges at those points where the gradient
% of I is maximum.
%
% The Roberts method finds edges using the Roberts approximation to
% the derivative. It returns edges at those points where the gradient
% of I is maximum.
%
% The Laplacian of Gaussian method finds edges by looking for zero
% crossings after filtering I with a Laplacian of Gaussian filter.
%
% The zero-cross method finds edges by looking for zero crossings
% after filtering I with a filter you specify.
%
% The Canny method finds edges by looking for local maxima of the
% gradient of I. The gradient is calculated using the derivative of a
% Gaussian filter. The method uses two thresholds, to detect strong
% and weak edges, and includes the weak edges in the output only if
% they are connected to strong edges. This method is therefore less
% likely than the others to be "fooled" by noise, and more likely to
% detect true weak edges.
%
% The parameters you can supply differ depending on the method you
% specify. If you do not specify a method, EDGE uses the Sobel method.
%
% Sobel Method
% ------------
% BW = EDGE(I,'sobel') specifies the Sobel method.
%
% BW = EDGE(I,'sobel',THRESH) specifies the sensitivity threshold for
% the Sobel method. EDGE ignores all edges that are not stronger than
% THRESH. If you do not specify THRESH, or if THRESH is empty ([]),
% EDGE chooses the value automatically.
%
% BW = EDGE(I,'sobel',THRESH,DIRECTION) specifies directionality for the
% Sobel method. DIRECTION is a string specifying whether to look for
% 'horizontal' or 'vertical' edges, or 'both' (the default).
%
% BW = EDGE(I,'sobel',...,OPTIONS) provides an optional string
% input. String 'nothinning' speeds up the operation of the algorithm by
% skipping the additional edge thinning stage. By default, or when
% 'thinning' string is specified, the algorithm applies edge thinning.
%
% [BW,thresh] = EDGE(I,'sobel',...) returns the threshold value.
%
% [BW,thresh,gv,gh] = EDGE(I,'sobel',...) returns vertical and
% horizontal edge responses to Sobel gradient operators. You can
% also use these expressions to obtain gradient responses:
% if ~(isa(I,'double') || isa(I,'single')); I = im2single(I); end
% gh = imfilter(I,fspecial('sobel') /8,'replicate'); and
% gv = imfilter(I,fspecial('sobel')'/8,'replicate');
%
% Prewitt Method
% --------------
% BW = EDGE(I,'prewitt') specifies the Prewitt method.
%
% BW = EDGE(I,'prewitt',THRESH) specifies the sensitivity threshold for
% the Prewitt method. EDGE ignores all edges that are not stronger than
% THRESH. If you do not specify THRESH, or if THRESH is empty ([]),
% EDGE chooses the value automatically.
%
% BW = EDGE(I,'prewitt',THRESH,DIRECTION) specifies directionality for
% the Prewitt method. DIRECTION is a string specifying whether to look
% for 'horizontal' or 'vertical' edges, or 'both' (the default).
%
% BW = EDGE(I,'prewitt',...,OPTIONS) provides an optional string
% input. String 'nothinning' speeds up the operation of the algorithm by
% skipping the additional edge thinning stage. By default, or when
% 'thinning' string is specified, the algorithm applies edge thinning.
%
% [BW,thresh] = EDGE(I,'prewitt',...) returns the threshold value.
%
% [BW,thresh,gv,gh] = EDGE(I,'prewitt',...) returns vertical and
% horizontal edge responses to Prewitt gradient operators. You can
% also use these expressions to obtain gradient responses:
% if ~(isa(I,'double') || isa(I,'single')); I = im2single(I); end
% gh = imfilter(I,fspecial('prewitt') /6,'replicate'); and
% gv = imfilter(I,fspecial('prewitt')'/6,'replicate');
%
% Roberts Method
% --------------
% BW = EDGE(I,'roberts') specifies the Roberts method.
%
% BW = EDGE(I,'roberts',THRESH) specifies the sensitivity threshold for
% the Roberts method. EDGE ignores all edges that are not stronger than
% THRESH. If you do not specify THRESH, or if THRESH is empty ([]),
% EDGE chooses the value automatically.
%
% BW = EDGE(I,'roberts',...,OPTIONS) provides an optional string
% input. String 'nothinning' speeds up the operation of the algorithm by
% skipping the additional edge thinning stage. By default, or when
% 'thinning' string is specified, the algorithm applies edge thinning.
%
% [BW,thresh] = EDGE(I,'roberts',...) returns the threshold value.
%
% [BW,thresh,g45,g135] = EDGE(I,'roberts',...) returns 45 degree and
% 135 degree edge responses to Roberts gradient operators. You can
% also use these expressions to obtain gradient responses:
% if ~(isa(I,'double') || isa(I,'single')); I = im2single(I); end
% g45 = imfilter(I,[1 0; 0 -1]/2,'replicate'); and
% g135 = imfilter(I,[0 1;-1 0]/2,'replicate');
%
% Laplacian of Gaussian Method
% ----------------------------
% BW = EDGE(I,'log') specifies the Laplacian of Gaussian method.
%
% BW = EDGE(I,'log',THRESH) specifies the sensitivity threshold for the
% Laplacian of Gaussian method. EDGE ignores all edges that are not
% stronger than THRESH. If you do not specify THRESH, or if THRESH is
% empty ([]), EDGE chooses the value automatically.
%
% BW = EDGE(I,'log',THRESH,SIGMA) specifies the Laplacian of Gaussian
% method, using SIGMA as the standard deviation of the LoG filter. The
% default SIGMA is 2; the size of the filter is N-by-N, where
% N=CEIL(SIGMA*3)*2+1.
%
% [BW,thresh] = EDGE(I,'log',...) returns the threshold value.
%
% Zero-cross Method
% -----------------
% BW = EDGE(I,'zerocross',THRESH,H) specifies the zero-cross method,
% using the specified filter H. If THRESH is empty ([]), EDGE chooses
% the sensitivity threshold automatically.
%
% [BW,THRESH] = EDGE(I,'zerocross',...) returns the threshold value.
%
% Canny Method
% ----------------------------
% BW = EDGE(I,'canny') specifies the Canny method.
%
% BW = EDGE(I,'canny',THRESH) specifies sensitivity thresholds for the
% Canny method. THRESH is a two-element vector in which the first element
% is the low threshold, and the second element is the high threshold. If
% you specify a scalar for THRESH, this value is used for the high
% threshold and 0.4*THRESH is used for the low threshold. If you do not
% specify THRESH, or if THRESH is empty ([]), EDGE chooses low and high
% values automatically.
%
% BW = EDGE(I,'canny',THRESH,SIGMA) specifies the Canny method, using
% SIGMA as the standard deviation of the Gaussian filter. The default
% SIGMA is 1; the size of the filter is chosen automatically, based
% on SIGMA.
%
% [BW,thresh] = EDGE(I,'canny',...) returns the threshold values as a
% two-element vector.
%
% Class Support
% -------------
% I is a nonsparse numeric array. BW is of class logical.
%
% Remarks
% -------
% For the 'log' and 'zerocross' methods, if you specify a
% threshold of 0, the output image has closed contours, because
% it includes all of the zero crossings in the input image.
%
% Example
% -------
% Find the edges of the circuit.tif image using the Prewitt and Canny
% methods:
%
% I = imread('circuit.tif');

mark_jz
- 粉丝: 16
最新资源
- CAD2007经典版第1章-入门基础.ppt
- 项目管理经验集锦(20211102053025).pdf
- 神经网络和应用.ppt
- 项目管理经验交流材料样本.doc
- 算法合集之分治算法在树的路径问题中的应用.pptx
- 整套施工进度计划网络图、横道图、平面图及相关附表.doc
- 最新网络技术在小学数学中的应用.doc
- 牛顿-拉夫逊迭代法极坐标潮流计算C语言程序.doc
- 基于PLC的生活热水控制系统(修改版).docx
- 工程项目管理----项目组织PPT课件.ppt
- 数控车削加工编程.ppt
- 精编大学生网络购物状况问卷调查报告参考范文.doc
- 在广电网络有限公司-分公司成立大会暨挂牌仪式上的讲话.pdf
- 制冷系统安全操作手册范本.doc
- 基于嵌入式的智能家居控制系统.pptx
- 高教大数据平台方案PPT课件.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



- 1
- 2
前往页