Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Watershed not working like expected

Hey,

I'm using Matlab to use OpenCV functions, I succesfull 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 I'm wrong?

Thank you

Watershed not working like expected

Hey,

I'm using Matlab to use OpenCV functions, I succesfull 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)
cv.watershed(rgbImage,marker);

The segmented matrix looks like this: image description

In Matlab using following function (even without markers) markers)

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

This is the correct result: image description

Where I'm am I wrong?

Thank you