finds edges in image and returns the result as a binary image.

EdgeDetect[image, r]
finds edges at the scale of the specified pixel range r.

EdgeDetect[image, r, t]
uses a threshold t for selecting image edges.

Details and OptionsDetails and Options

  • EdgeDetect uses gradient methods to find edges.
  • EdgeDetect[image] is equivalent to EdgeDetect[image, 2].
  • EdgeDetect[image, r, t] uses hysteresis thresholding with a global threshold t. For additional forms of the threshold parameter, see the reference page for MorphologicalBinarize.
  • EdgeDetect takes a Padding option. The default setting is Padding->"Fixed".
  • EdgeDetect[image, {r1, r2}, ...] uses radii in vertical and horizontal directions.
  • The Canny edge detection algorithm is used by default. With an explicit setting of the Method option, other derivative filters can be specified. Possible settings include:
  • "Canny"first-order directional Gaussian derivatives
    "ShenCastan"first-order derivatives of exponentials
    "Sobel"binomial generalization of Sobel masks
  • An option setting "StraightEdges"->s can be used to control the selection of edges based on their straightness. With the default setting , all edges are returned. A setting selects only the longest and strongest lines.

ExamplesExamplesopen allclose all

Basic Examples (2)Basic Examples (2)

Detecting edges in a color image:

Click for copyable input

Specify the scale of edges to detect:

Click for copyable input
New in 8
New to Mathematica? Find your learning path »
Have a question? Ask support »