x,y,z coordinates

May 15, 2012 at 4:25 PM

I'm trying to get x,y,z coordinates with coding4fun function, in order to create a point cloud, any suggestions?? and most important is it possible?? otherwise, how can i collect all the coordinates for each points corrisponding to reality in a text and maybe plotting outside, matlab for ex?? I saw some functions for skeleton but I'm not interest in tracking skelecton cause I have to create a map of the ground.

May 15, 2012 at 8:15 PM

You can do this pretty easily directly with the depth buffer.  The x,y coordinates are the location indexes in the depth array (y * width + x), and the z coordinate is the value at that position in the array in millimeters.

May 16, 2012 at 10:10 AM

so seems it's possible, thank you!! can you explain me more??

in my code I use


imageFrame = e.OpenDepthImageFrame();


if (imageFrame != null) {

var depthArray = imageFrame.ToDepthArray();


so I have an array of depth for every single point.

How can I collect the relatives x and y points ?

and after that, how can I plot them to see a point cloud?? is there any function to do it in visual studio? or should I have to collect the pooint into a txt and plot them in matlab??

thank you for the answer and the patience ;)

May 16, 2012 at 1:14 PM

There is no automatic way to create a point cloud in Visual Studio. I'm unfamiliar with Matlab so I'm not sure how it would work there.  Regardless, you just need to enumerate through that array you now have in depthArray with a for loop or nested for loops (pseudo-code follows):

for(y = 0; y < 240; y))
  for(x = 0; x < 320; x++)
     short depthPt = [y * 320 + x];
     // do something with it

You can also just use the imaggeFrame.CopyPixelDataTo() to get that depth data with the latest RTM SDK.

May 16, 2012 at 1:25 PM

ok thank you so much for your help, I'll find a way to get the point cloud but this is a great start for me !!! thank you again =) !!