xiaohongwu / aforge

Automatically exported from code.google.com/p/aforge
Other
0 stars 0 forks source link

Canny edge detector gives wrong result #52

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Try to filter the attached "word" image through Canny edge detector

What is the expected output? What do you see instead?
Expected was a typical 1-pixel wide edges picture. Instead, the detected
edges were about 4 pixels wide.

This happens because the gradient values, when computed, are clipped to
255. In the "word" image, gradients are high, and this creates regions with
equal gradient values. Then the non-maximum suppression fails, and counts
many pixels as edge. The solution is to store the gradient values as
floating-point numbers, instead of byte integers, then they'll have clear
maximums, as intended.
In the current code, in the non-maximum suppression part there is also a
problem of writing in the same array which is being analyzed, this can
create false edge points too. 

Attached is the code which, I believe, performs the correct Canny edge
detection. I think that other edge detectors need a review as well.

Original issue reported on code.google.com by inea...@gmail.com on 25 Feb 2008 at 8:07

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 26 Feb 2008 at 6:36

GoogleCodeExporter commented 8 years ago
Canny Edge Detector is fixed to use floating point gradients array to correct 
non-
maximum suppression and location of edge points.

The fix is committed in revision 468. Will be released in version 1.6.2

Original comment by andrew.k...@gmail.com on 28 Feb 2008 at 3:02

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 17 May 2008 at 6:29

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 19 May 2008 at 6:08