Watershed not working like expected

asked 2016-03-24 10:28:29 -0500

maestroo gravatar image

updated 2016-03-24 10:30:55 -0500

Hey,

I'm using Matlab to use OpenCV functions, I succesfully used the watershed function from Matlab, but OpenCV variant is not working.

I'm using following int8 depth image: image description

because openCV using RGB image format, I replicated these values in a MxNx3-matrix. As marker I have an int32 matrix where I pointed every local minimum (5 in total), image description

By using following function

resultOpenCV= cv.watershed(rgbImage,marker);

The segmented matrix looks like this: image description

In Matlab using following function (even without markers)

resultMatlab= watershed(rgbImage(:,:,1));

This is the correct result: image description

Where am I wrong?

Thank you

edit retag flag offensive close merge delete

Comments

please show your opencv code.

(btw, opencv uses bgr, not rgb)

berak gravatar imageberak ( 2016-03-24 10:43:13 -0500 )edit

I'm using https://github.com/kyamagu/mexopencv Matlab MEX functions that interface OpenCV 3.0.1 APIs

maestroo gravatar imagemaestroo ( 2016-03-24 10:58:31 -0500 )edit
maestroo gravatar imagemaestroo ( 2016-04-02 20:36:52 -0500 )edit