Ask Your Question

Watershed on gray image

asked 2014-01-15 06:38:29 -0500

Hansg91 gravatar image


I am trying to perform the watershed transform on a grayscaled image (edge map, to be precise), but the opencv implementation of watershed gives me the error that my image is not in 3 dimensions.

segmentation.cpp:147: error: (-210) Only 8-bit, 3-channel input images are supported in function cvWatershed

Why would this not be supported? Should I modify the watershed algorithm or implement my own based on grayscale images?

Best regards, Hans

edit retag flag offensive close merge delete


I think you should check the channel of the image.Maye it's not grayscaled image.

wuling gravatar imagewuling ( 2014-01-15 17:53:19 -0500 )edit

It is, which is why it is giving an error. It expects a 3 channel image.

Hansg91 gravatar imageHansg91 ( 2014-01-18 05:59:10 -0500 )edit

I agree this is annoying - even if you can add 2 dummy channels.

dma gravatar imagedma ( 2014-02-18 12:35:43 -0500 )edit

I guess I have something to do in the weekend then.. I really need it :P

Hansg91 gravatar imageHansg91 ( 2014-02-19 08:32:47 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-02-22 07:16:07 -0500

Hansg91 gravatar image

I made some small changes to cv::watershed, it works now on grayscale images as well.

edit flag offensive delete link more

Question Tools


Asked: 2014-01-15 06:38:29 -0500

Seen: 1,863 times

Last updated: Feb 22 '14