At the moment I'm working with a ToF camera and I receive a distance image(matrix). I'm able to use Matlab watershed function to find all the valleys in the image.
Now I'm trying to use OpenCV watershed function, but it uses a RGB image as input. I tried to convert it to an RGB image (from grayscale to 255, followed by replicating to MxNx3-Matrix), but I'm getting wrong results.
resultOpenCV= cv.watershed(rgbImage,marker);
Is there some watershed function for depth images in OpenCV? Thanks.
Comparison Matlab watershed vs cv.watershed in Matlab: https://gist.github.com/amroamroamro/6423064ee20ad1a3d4de93ad7d68d8f5
mat file: https://www.dropbox.com/s/6whxuz111vu4ulp/watershedExample.mat?dl=0