Ask Your Question
1

Watershed on gray image

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

Hansg91 gravatar image

Hello,

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

Comments

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 -0600 )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 -0600 )edit

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

dma gravatar imagedma ( 2014-02-18 12:35:43 -0600 )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 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
3

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

Hansg91 gravatar image

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

https://github.com/Itseez/opencv/pull/2392

edit flag offensive delete link more

Question Tools

Stats

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

Seen: 2,605 times

Last updated: Feb 22 '14