I am doing my own implementation of Canny and Sobel in another language (not in Mathematica). I was testing the EdgeDetect method (Sobel and Canny), and my own, and I am getting different results.

What kind of preprocessing does EdgeDetect do to the image before detecting the edges, and what kind of threshold does it use?

  • 1
    $\begingroup$ While I don't know much about these methods, looking at what Mathematica and MATLAB do differently: it seems thresholding is not done the same way. See under Details in the EdgeDetect docs. $\endgroup$
    – Szabolcs
    Apr 5, 2016 at 7:47

1 Answer 1


If you drill down the documents' details and options you may find some useful information. Here is my take:

EdgeDetect has 2 main parameters pixel range r and t for threshold. The document says the r's default value is 2. For threshold t uses hysteresis thresholding with a global threshold t. For additional forms of the threshold parameter, see the reference page for MorphologicalBinarize is pointed in the document. MorphologicalBinarize automatically choosing a suitable value for the lower threshold. FindThreshold uses default "Cluster" method which is cluster variance maximization (Otsu's algorithm).

In addition the method may contain StraightEdges; Method->{"method","StraightEdges"->s}. The default behavior is equivalent to "StraightEdges"->0. A setting "StraightEdges"->1 selects only the longest and strongest lines.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.