Ask Your Question

Gaps in canny-detected edges

asked 2012-12-16 13:04:38 -0500

walkingbeard gravatar image


I'm having trouble detecting edges with the Canny function. Despite running on a binary image (shouldn't that be easy?) there are gaps in the final contour. Maybe I'm using the wrong parameters, but I'm a little unclear on what each one does.

I am running cv::Canny(imgOut, imgOut, 0, 0, 3, true) on:image description and getting: image description

Here is a zoom. Currently, the red pixel is actually black, but it needs to come out white. Can this be reasonably achieved? image description

Make thanks!

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2012-12-17 01:43:54 -0500

Haris gravatar image
edit flag offensive delete link more


Yes, amazing advice. Thank you so much

Dodo gravatar imageDodo ( 2014-12-28 14:54:54 -0500 )edit

answered 2012-12-17 00:01:00 -0500

Daniil Osokin gravatar image

Hi! You can try to increase aperture size (like 5 or more), also try to run findContours instead of Canny.

edit flag offensive delete link more

answered 2012-12-17 04:35:18 -0500

venky gravatar image

Hi, One option may be to use the laplacian option in Canny Canny( InputArray image, OutputArray edges, double threshold1, double threshold2, int apertureSize=3, bool L2gradient=false ); make the L2gradient=true and check the result out.

If possible try to check if the Matlab canny detector gives the same result. As suggested by Daniil Osokin you could use find contours as an alternate if you have only Binary images.

Thanks Venky

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2012-12-16 13:04:38 -0500

Seen: 8,482 times

Last updated: Dec 17 '12