Advertisement
lamiastella

RealSenseDevice::GetCameraPos

May 24th, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. void RealSenseDevice::GetCameraPos(Point2i screenPoint, Point3f &cameraPoint)
  2. {
  3.   if(screenPoint.x >= m_nColorSize.width || screenPoint.y >= m_nColorSize.height || screenPoint.y < 0 || screenPoint.x < 0)
  4.   {
  5.   cameraPoint.x = -1;
  6.   cameraPoint.y = -1;
  7.   cameraPoint.z = -1;
  8.   return ;
  9.   }
  10.  
  11.   int nIndex = screenPoint.x + screenPoint.y*m_nColorSize.width;
  12.   RealSense::PointF32 pos = m_uvmap[nIndex];
  13.   if(pos.x != -1 && pos.y != -1)
  14.   {
  15.   nIndex = m_uvmap[nIndex].x*m_nDepthSize.width + m_uvmap[nIndex].y*m_nDepthSize.height * m_nDepthSize.width;
  16.  
  17.  
  18.   cameraPoint.x =  m_vertices[nIndex].x;
  19.   cameraPoint.y =  m_vertices[nIndex].y;
  20.   cameraPoint.z =  m_vertices[nIndex].z;
  21.   }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement