[英]Kinect: How to map depth coordinates to world coordinates using openni?
我需要使用Openni將深度圖映射到世界坐標。
因此,我不能使用任何MSDN代碼,例如“ MapDepthToSkeletonPoint”或“ MapDepthToSkeletonPoint”或“ NuiTransformDepthImageToSkeleton”。
我嘗試使用URL“ http://www.tagwith.com/question_495583_kinect-from-color-space-to-world-coordinates ”中的以下等式:
x = (u - principalPointX) / focalLengthX * d;
y = (z - principalPointY) / focalLengthY * d;
z = d;
但是雖然我嘗試使用方法“ getDepthCameraIntrinsics”,但我既無法獲得principalPointX,也無法獲得focalLengthX,但是它給了我NaN的值。
我希望有人可以幫助實現這一轉變。
我找到了解決此問題的方法:通過OpenNIGrabber獲取設備處理程序,然后獲取深度輸出模式,然后獲取nXRes和nYRes,就像下面的代碼一樣
depth_principal_x = ((pcl::OpenNIGrabber*)capture_)->getDevice()->getDepthOutputMode().nXRes;
depth_principal_y = ((pcl::OpenNIGrabber*)capture_)->getDevice()->getDepthOutputMode().nYRes;
focal_length= ((pcl::OpenNIGrabber*)capture_)->getDevice()->getDepthFocalLength();
然后,使用上面代碼中分配的變量使用以下代碼:
x = (u - depth_principal_x) / focal_length * d;
y = (z - depth_principal_y) / focal_length * d;
z = d;
我希望這個能幫上忙
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.