MATLAB: 3D Point Cloud watershed

clouderrorImage Processing Toolboxmatrixpointwatershedxyz

I have a Point Cloud or the equivalent of a 2D nx3 matrix of my x,y,z coordinates which generate a volume. I am trying to call "watershed" on it, but I am getting unexpected results. Why is this happening?

Best Answer

The "watershed" function takes in an input image, specified as a real, nonsparse, numeric, or logical array of any dimension.
"watershed" is not throwing an error because your input is of the correct type. However, "watershed" is interpreting your data as a 2D image that is nx3 and not a 3D Volume that would be generated by a Point Cloud.
In order to get the correct "watershed" output, input the 3-D binary image of the volume and not the Point Cloud (x,y,z) data.
For more information please see the following documentation page: