Watershed not working like expected [closed]

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

maestroo gravatar image

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


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 reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-10-06 05:15:29.611492


please show your opencv code.

(btw, opencv uses bgr, not rgb)

berak gravatar imageberak ( 2016-03-24 10:43:13 -0600 )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 -0600 )edit
maestroo gravatar imagemaestroo ( 2016-04-02 20:36:52 -0600 )edit