Subscribe:

Ads 468x60px

Showing posts with label Kinect 3D Coordinate with OpenNI. Show all posts
Showing posts with label Kinect 3D Coordinate with OpenNI. Show all posts

Thursday, August 2, 2026

How to get 3D Coordinates from Kinect

This is a simple tutorial helps you to get the 3D coordinates from Kinect using OpenNI library

Code snippet

 xn::DepthGenerator & Xn_depth;  
 const XnDepthPixel * pDepthMap = Xn_depth.GetDepthMap();  
 XnPoint3D Point2D, Point3D;  
 Point2D.X = ii;   //x-pixels  
 Point2D.Y = jj;  //y-pixels  
 Point2D.Z = pDepthMap[jj*640+ii];Xn_depth.ConvertProjectiveToRealWorld(1, &Point2D, &Point3D);  


Example Code showing the usage of this snippet. This code combine OpenCV and OpenNI. It gives X,Y,Z coordinate of the desired x,y pixel that we supply through command line argument.

Setting OpenCV in Windows

Installing OpenNI in Windows 7

Setting OpenNI in Visual studio 2010