MATLAB: How to find distance between two points in a point cloud

image acquisitionimage analysisimage processingimage segmentationkinectMATLAB

I have a point cloud obtained from kinect in matlab. I need to find distance between any two points of my interest. If possible how do I select the points and find distance between them, please help me.

Best Answer

Use sqrt().
First convert x and y to cm or m or whatever units your depth image are in (VERY IMPORTANT).
Then just do
z1 = depthImage(y1, x1);
z2 = depthImage(y2, x2);
distance = sqrt((x1-x2)^2 + (y1-y2)^2 + (z1-z2)^2)