Talk:Canny edge detector

From Wikipedia, the free encyclopedia
Jump to: navigation, search
          This article is of interest to the following WikiProjects:
WikiProject Robotics (Rated C-class, Mid-importance)
WikiProject icon Canny edge detector is within the scope of WikiProject Robotics, which aims to build a comprehensive and detailed guide to Robotics on Wikipedia. If you would like to participate, you can choose to edit this article, or visit the project page (Talk), where you can join the project and see a list of open tasks.
C-Class article C  This article has been rated as C-Class on the project's quality scale.
 Mid  This article has been rated as Mid-importance on the project's importance scale.
WikiProject Computing (Rated C-class, Mid-importance)
WikiProject icon This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
C-Class article C  This article has been rated as C-Class on the project's quality scale.
 Mid  This article has been rated as Mid-importance on the project's importance scale.
WikiProject Computer science (Rated Start-class, Mid-importance)
WikiProject icon This article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start-Class article Start  This article has been rated as Start-Class on the project's quality scale.
 Mid  This article has been rated as Mid-importance on the project's importance scale.

Gaussian Mask[edit]

Some more explanation might go into how the Gaussian filter is computed. I wrote a short matlab script for creating a Gaussian filter. I managed to reverse engineer my output to look like this one (I multiply my answer by 159, then round to the nearest integer, resulting in the integer matrix in the article). Otherwise the one given here seems magical. I have extensive training in math, which probably made it easier to figure it out. Others might not be so lucky. Also, my Gaussian filter that best approximates the one in the article is obtained using sigma=1.4, not sigma=0.4 as it says in the article. Either the article is using different conventions for sigma, or there is an error (I've checked my script a few times to make sure the error isn't mine). If you are using different conventions, they should be explained. If it is an error, it should be corrected.

Perhaps a separate article on Gaussian masks is warranted. I understand the idea behind the Gaussian mask, but I have no expertise, so I can only make guesses as to how it is actually used in practice. What rounding conventions are used? How does one determine what size of mask to use? I don't know the answers to these questions, and I think they are relevant. There is an article on Gaussian filters, but it sheds little to no light on their use in image processing.

Mathmoose (talk) 02:24, 1 October 2008 (UTC)

I would like to support this statement: the algorithm for computing the kernel of the Gaussian filter (the matrix) should be provided. At least it would be nice if the section Noise Reduction contained a link to Gaussian_function. Please also note that Gaussian_filter contains a somewhat flawed approach to Gaussian kernel construction: the gaussian function for two dimensions from that article has a relatively small multiplication factor which, combined with truncation, gives way too many zeros (practically all the matrix is zeroed) if one aims for a kernel of integers (not doubles). All3fox (talk) 19:33, 23 September 2013 (UTC)

Differential Edge detection[edit]

This section does not seem to fit in an article on the Canny edge detector. In a more general article on edge detection, sure - but not here. Xomex (talk) 00:34, 12 March 2008 (UTC)

The approach of differential edge detection can basically be seen as a reformulation of the Canny edge detector from a differential geometric viewpoint at multiple scales. For this reason, I think it is appropriate to mention it within this article. Nevertheless, I have now replaced the text with a link to the section in the article on edge detection where the differential approach is described in more detail. Tpl (talk) 14:24, 15 March 2008 (UTC)

Non-maximal suppression[edit]

Is there not a step called non-maximal suppression done before the hysteresis step? to be brief, this step deletes pixels normal to the edge direction that are above the gradient of the pixel in question... Cozmoash 18:15, 1 May 2007 (UTC)

There is indeed such a step, and (if I recall correctly) it was one of the novel things about Canny's approach. These pages seem like reasonable references: [1], [2], [3]. --Iknowyourider (t c) 19:38, 18 June 2007 (UTC)
Now, there is a description of the non-maximum suppression stage in the article page. Since I hope that the missing information should have been clarified, I have now removed the tag about disputed article. Tpl
Awesome, thanks! Iknowyourider (t c) 14:50, 18 July 2007 (UTC)

I think the directions for the non-maximum suppression step are totally wrong. The gradient angle tells in which direction the biggest change appears, so it is perpendicular on the edge direction. If we want to thin the edge, we should suppress in the direction of the gradient angle. For example, for a zero degrees angle, we should check in the east and west directions. Ștefan Istrate 12:55, 22 April 2010 (UTC) —Preceding unsigned comment added by Stef2n (talkcontribs)

I just noticed this myself, and I think you're correct. If the gradient angle is zero, that means that there is relatively little change along the y-axis and more along the x, and we're only on an edge if we're peaking (or bottoming out) as we move along the x-axis. Thus, we would want to check the east and westward points as you said. Addendum: the description before the bullet points describes the correct idea, so I will change the bullets to reflect it. Paulcd2000 (talk) 20:40, 16 July 2010 (UTC)
I reverted this change, and I'm relatively sure that the earlier version (north/south gradient -> check east west points) was wrong. The earlier version would mean that if you saw a horizontal edge (which would give a line of north-south gradients), you'd ignore any point that had a horizontal neighbor with a straighter edge, giving you gaps in a horizontal line. This is not what you want -- you want to thin edges, which implies you check in the direction of the gradient. Achal (talk) 03:30, 18 October 2013 (UTC)

Can someone explain "This is worked out by passing a 3x3 grid over the intensity map." a little bit more in detail? —Preceding unsigned comment added by (talk) 02:07, 31 October 2010 (UTC)

Well, this section seems to be quite strangely written. First it tells that we find gradient direction, and then it proceeds to tell that we search that a gradient has a maximum in the gradient direction. Well, as far as I remember the mathematical definition of the gradient in a direction it is a projection of the vector gradient to the direction, and thus, automatically has a maximum in the (vector) gradient direction.

So that I assume there should be two different gradients. Most likely the first gradient we are talking about is a vector gradient obtained after the gaussian blurring, and the second gradient (in north, south, west, east, n-w, s-e ..) is just a difference of the nearby pixel values on the original (non-blurred) image. If it is so, this should be clearly indicated, otherwise this part of the article is very confusing. Begemotv2718 (talk) 22:17, 2 December 2011 (UTC)

There should be a few lines mentioning or explaining interpolating gradient magnitudes (subpixel sampling), but I don't know it well enough to explain it properly. Some resources: Achal (talk) 03:30, 18 October 2013 (UTC)

Proposal to change to "Canny edge detection"[edit]

just noticed that there already is an article Canny edge detector which redirects to Canny. I propose to make it the other way: redirect "Canny" to "Canny edge detector" because

  • Canny is not a good name for this article. Although the method described here sometimes is colloquially refered to as "Canny", it is rather the name of the inventor. If I was Canny, I would expect to see a nicly written article about myself. "Canny edge detector" or even "Canny's edge detector" is more descriptive given the content of the article.
  • Changing the title means that we can get rid of the disambiguation stuff in the beginning of the article.

--KYN 22:36, 31 July 2007 (UTC)

Agree with move. Iknowyourider (t c) 05:28, 1 August 2007 (UTC)

I have now made the proposed change, the new location for the article is Canny edge detector. Did not copy this talk page since it appears to be of low relevance to future readers of the article. --KYN 13:49, 3 August 2007 (UTC)

Recent edits[edit]

Did some edits in the article with the following in mind:

  • Removed comment on second derivative is less affected by noise in the "Noise reduction" section. Even if it true (?) it does not appear to be part of the story told in the article.
  • Changed "mask" to "filter". Mask is not described in WP in the meaning of a filter. Also, filter is already used at several places in the article: better to be consistent.
  • Attempted to figure out what to do with that compvis navigation bar because the thing ruins the layout of the page in ie7 —Preceding unsigned comment added by (talk) 01:47, 10 June 2009 (UTC)

Coloured edge direction image[edit]

--Volyrkr (talk) 20:59, 20 August 2010 (UTC) This text is under the first colored edge image:
A binary edge map, derived from the Sobel operator, with a threshold of 80. The edges are coloured to indicate the edge direction: yellow for zero degrees, green for 45 degrees, blue for 90 degrees and red for 135 degrees.

As I understand it must be yellow for 90, blue for 0, green for 135, red for 45. The direction of the edge is the direction of the gradient, right?

Nope. As mentioned above, the gradient is perpendicular (90 degrees off) to the edge direction. You can think of the gradient as the direction of change. -- (talk) 15:30, 12 November 2010 (UTC)
Hm... I think that Volyrkr is right. Look at the image: the yellow edges themselves are roughly horizontal which means the direction of the change is 90 degrees, not 0. The blue edges are roughly vertical which mean a direction of change of 0 degrees. It actually confused the hell out of me because I was just implementing the algorithm with the colors you described and getting a very different color map. I'm going to change it. Also, if you could give us the gaussian you started with that would be nice. Think of it as a citation. Armence (talk) 15:10, 11 February 2011 (UTC)

"to detect a wide range of edges in images"[edit]

what is really meant is probably "to detect a wide range of kinds of edges in images" -- (talk) 09:43, 25 May 2011 (UTC)

"the algorithm should mark as many real edges in the image as possible"[edit]

In this context, is it assumed that there's no ambiguity in the original image as to what is an edge and what is not? What are the real edges of a cloud, or of a diffuse shadow? -- (talk) 09:50, 25 May 2011 (UTC)

One way of handling diffuse edges like shadow edges is described in the following cited reference:

  • Lindeberg, Tony "Edge detection and ridge detection with automatic scale selection", International Journal of Computer Vision, 30, 2, pp 117—154, 1998.

The multi-scale edge detection approach developed in this article should also be applicable to edges of clouds. Tpl (talk) 08:23, 1 June 2011 (UTC)

Corner detector?[edit]

Why is there an image of a corner detector here? Why is it relevant when talking about Canny? — Preceding unsigned comment added by (talk) 17:45, 9 February 2012 (UTC)

Article is incomplete[edit]

The introductory section of the article, Development of the Canny Algorithm, says:

"The optimal function in Canny's detector is described by the sum of four exponential terms, but can be approximated by the first derivative of a Gaussian."

But this function is never defined. Since it is probably of central importance to the Canny edge detector, a description of the function should be added. — Preceding unsigned comment added by (talk) 07:34, 23 September 2012 (UTC)

Article doesn't reflect the original paper[edit]

After studying the original Canny paper in some detail, i'm finding it very difficult to translate the original steps directly into the ones described in this article. From what i gather, the smoothing step using a Gaussian kernel is actually not necessary if the edge detection operator is a 1st order Gaussian derivative. Also, nowhere in the paper does Canny mention that a Sobel kernel should be used to detect edges. In fact he goes to great lengths to show that the Gaussian Derivative is a close approximation to the optimal detector (at least for step edges). The relevant formulas in the paper are (45) and (46):

The words nonmaximum suppression actually only appear twice in the paper and they are not defined. The closest thing to a definition i can find is formula (47) where the 2nd order directional derivative is searched for zeros:

This is of course analogous to what is described in the wiki section, but i can't help but feel that some interpretation has taken place. Not necessarily a bad thing, mind, but since the method is attributed solely to Canny i think the article should reflect the content of the original paper more closely.

This article seems more like a description of the "popular" version of the Canny detector, rather than the actual one. It's a shame since there's quite a lot of ingenuity in the paper that doesn't see the light of day. — Preceding unsigned comment added by (talk) 13:09, 1 May 2013 (UTC)

automatic calculation of low and high thresholds for the canny operation[edit]

There is some interesting discussion (with links to papers) on automatic calculation of low and high thresholds for the canny operation here: It would be great if some of these ideas were integrated into the article rather than it just saying "It is difficult to give a generic threshold that works well on all images. No tried and tested approach to this problem yet exists." — Preceding unsigned comment added by Cancan101 (talkcontribs) 04:37, 29 April 2014 (UTC)