Ask Your Question
2

Missing/double edges in OpenCV/scikit-image implementations of Canny edge detector

asked 2015-12-31 06:41:48 -0600

wibr gravatar image

If found that the Canny edge detector in OpenCV (2.4.9 on OSX via brew), applied on the binary test image below (left), misses an edge segment at the upper right corner (middle). For comparison I tried scikit-image (right), which produces a small hole at the top (can be fixed using different parameters) and double edges (which should not happend according to my understanding of the algorithm).

input file output canny opencv output canny scikit-image

I tried different parameters with no effect, probably because the input image is already a binary image.

Code:

# opencv
canny=cv2.Canny(image,300,500)
# scikit-image
canny = img_as_ubyte(feature.canny(image, 1, 300, 500))

Is this expected behaviour? Anything I can do to prevent those gaps?

edit retag flag offensive close merge delete

Comments

try do disable opencl and fixed aperture size to 5 and make an issue Can you post orignal image in png instead of jpg?

LBerger gravatar imageLBerger ( 2016-01-01 08:43:09 -0600 )edit

Thanks for the suggestions! The images are all png already...

wibr gravatar imagewibr ( 2016-01-01 08:54:08 -0600 )edit

sorry I made an error it's a png image but it's not a binary image you have got some values like 64, 128, 192 and 255 in your image. Forget this remark that's not an answer to your problem

LBerger gravatar imageLBerger ( 2016-01-01 09:03:48 -0600 )edit

Yeah true the donut is not binary, don't think it should make a difference, though.

wibr gravatar imagewibr ( 2016-01-01 09:06:31 -0600 )edit

Using an aperture size of 5 works in this case. However, I can't answer my own question yet.

wibr gravatar imagewibr ( 2016-01-01 10:18:23 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-01-04 09:29:51 -0600

wibr gravatar image

Answer is already in the comments, it works with an aperture of 5. I also submitted an issue.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-12-31 06:41:48 -0600

Seen: 1,112 times

Last updated: Jan 04 '16