edge
Find edges in 2-D grayscale image
Syntax
Description
specifies the orientation of edges to detect. The Sobel and Prewitt methods can
detect edges in the vertical direction, horizontal direction, or both. The
Roberts method can detect edges at angles of 45° from horizontal, 135° from
horizontal, or both. This syntax is valid only when BW
= edge(I
,method
,threshold
,direction
)method
is "Sobel"
, "Prewitt"
, or
"Roberts"
.
[
also returns the directional gradients. For the Sobel and Prewitt methods,
BW
,threshOut
,Gx
,Gy
]
= edge(___)Gx
and Gy
correspond to the
horizontal and vertical gradients, respectively. For the Roberts methods,
Gx
and Gy
correspond to the
gradient at angles of 135° and 45° from horizontal, respectively. This syntax is
valid only when method
is "Sobel"
,
"Prewitt"
, or "Roberts"
.
Examples
Input Arguments
Output Arguments
Algorithms
For the gradient-magnitude edge detection methods (Sobel, Prewitt, and Roberts),
edge
usesthreshold
to threshold the calculated gradient magnitude.For the zero-crossing methods, including Laplacian of Gaussian,
edge
usesthreshold
as a threshold for the zero-crossings. In other words, a large jump across zero is an edge, while a small jump is not.The Canny method applies two thresholds to the gradient: a high threshold for low edge sensitivity and a low threshold for high edge sensitivity.
edge
starts with the low sensitivity result and then grows it to include connected edge pixels from the high sensitivity result. This helps fill in gaps in the detected edges.In all cases,
edge
chooses the default threshold heuristically, depending on the input data. The best way to vary the threshold is to runedge
once, capturing the calculated threshold as the second output argument. Then, starting from the value calculated byedge
, adjust the threshold higher to detect fewer edge pixels, or lower to detect more edge pixels.
References
[1] Canny, John, "A Computational Approach to Edge Detection," IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. PAMI-8, No. 6, 1986, pp. 679-698.
[2] Lim, Jae S., Two-Dimensional Signal and Image Processing, Englewood Cliffs, NJ, Prentice Hall, 1990, pp. 478-488.
[3] Parker, James R., Algorithms for Image Processing and Computer Vision, New York, John Wiley & Sons, Inc., 1997, pp. 23-29.
Extended Capabilities
Version History
Introduced before R2006aSee Also
edge3
| fspecial
| imgradient
| imgradientxy