Re: How can I get xyz co-ordinate of an pixel using kinect depth output?

Posted by matlabbe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/How-can-I-get-xyz-co-ordinate-of-an-pixel-using-kinect-depth-output-tp3627p3633.html

Hi Mao,

you need the CameraInfo message published by openni to get calibration parameters (e.g., focal length). Create a PinholeCameraModel from the CameraInfo, then you can use projectPixelTo3dRay:
cv::Point3d image_geometry::PinholeCameraModel::projectPixelTo3dRay 	( 	const cv::Point2d &  	uv_rect	) 	const
To get actual 3D point from the camera, multiply the returned 3D vector by the depth value.

cheers,
Mathieu