Open matbee opened 8 years ago
This is really a question for OpenCV Q&A or Stack Overflow... The mexopencv code for the watershed function is doing very little, other than converting between OpenCV and MATLAB arrays, and calling the C++ function: https://github.com/kyamagu/mexopencv/blob/master/src/%2Bcv/watershed.cpp
Ultimately these two functions are different implementations of the algorithm; MATLAB watershed
implements the watershed transform, while OpenCV cv::watershed
implements an interactive marker-based watershed segmentation.
Hey,
I succesfully used the watershed function from Matlab, but OpenCV variant is not working. I'm not sure if this is mexopencv related, maybe I misunderstood the watershed algorithm in OpenCV.
I'm using following int8 depth image:![image description](http://i.imgur.com/r4xCh0c.png)
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](http://i.imgur.com/DeeTbTv.png)
By using following function
The segmented matrix looks like this:![image description](http://i.imgur.com/KqAMbks.png)
In Matlab using following function (even without markers)
This is the correct result:![image description](http://i.imgur.com/2ggnHcD.png)
Where am I wrong?
Thank you