Last couple of questions touched upon Canny edge detector

What are the limitations of a Canny edge detector? and
Best way of segmenting veins in leaves?

The basic outline of the algorithm is as follows:

a. Apply Gaussian Convolution. (Choice of $\sigma$ to be made here)
b. Apply 2D derivative
c. Tracking through the ridges of this edges and thresholding (set pixels to zero which are not on the edge) with Hysteresis Lower and Higher T0 and T1 (Choice of $T0$ and $T1$ to be made here).

Read this for more background.

While, it is claimed that Canny is optimal; when getting practical results matters, tweaking factors as listed above $\sigma, T0,$ and $T1$ does make a lot of difference.

So how does one select these (tweaking) parameters practically? Even if, there is no definite approach or value, what is the general technique to know this?


1 Answer 1


Following http://www.kerrywong.com/2009/05/07/canny-edge-detection-auto-thresholding/ is one of the few resources that shows how to choose thresholds Tlow and Thigh

According to this, for a picture which is sufficiently spread in historgram, one can choose T_low = 0.66 * mean value of image and T_high = 1.33 * mean value.

However, when the image is not sufficiently spread, one should use median as opposed to mean value of the image.

If the gap between T_low and T_high is very small, the resultant edges will be smaller in continuity and hence there will be more fractions. As the gap increases, you will have more single line edges.

As regards to sigma, as the sigma increases, the smoothing increases and noisy edges will go away, but at the same time, the location of edges may also move little. See this document, http://www.cse.unr.edu/~bebis/CS791E/Notes/EdgeDetection.pdf and results at page 29 shows this effect.


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.