Software Archive
Read-only legacy content
Avisos
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discusiones

How do i unproject a depth image to world coordinate ?

peter_s_2
Principiante
2.157 Vistas

Is there any function or opensource that can unproject depth image to camera space or world space?

I want to transform the depth image to point cloud and show on computer.

Thanks for your attention.

0 kudos
1 Solución
Alexey_V_Intel
Empleados
2.157 Vistas

A function ProjectDepthToCamera uses for unprojection a cloud of points from depth image to world. "The world coordinates uses the camera coordinate system. The values are in mm." (chapter 6.14.2.8 of sdkmanual).

But if you want to unproject to world whole depth image, make sense to use QueryVertices. "The QueryVertices function calculates the vertices from the depth image. The vertices contain the world coordinates in mm." (chapter 6.14.2.11 of sdkmanual).

Ver la solución en mensaje original publicado

3 Respuestas
Alexey_V_Intel
Empleados
2.158 Vistas

A function ProjectDepthToCamera uses for unprojection a cloud of points from depth image to world. "The world coordinates uses the camera coordinate system. The values are in mm." (chapter 6.14.2.8 of sdkmanual).

But if you want to unproject to world whole depth image, make sense to use QueryVertices. "The QueryVertices function calculates the vertices from the depth image. The vertices contain the world coordinates in mm." (chapter 6.14.2.11 of sdkmanual).

peter_s_2
Principiante
2.157 Vistas

I use "QueryVetices" and get result which i want. Thanks a lot.

Thanh_Binh_T_
Principiante
2.157 Vistas

I used ProjectDepthToCamera for unprojection a point cloud within a Region of Interest, defined by xbegin, ybegin, width and height as follows,

but I do not get a dense 3Dpoints for a scene, where my face is at a distance of 50cm.

I really do not know, if my code is wrong? or F200 provides no dense 3Dpoints. Could you please help me? Thanks

   bool convertDepthToWorldCS(int xbegin, int ybegin, int width, int height)
   {
      unsigned int xend   = xbegin + width;
      unsigned int yend   = ybegin + height;

      unsigned int wxhDepth = width * height;

      // create the array of depth coordinates + depth value (posUVZ) within the defined ROI
      PXCPoint3DF32* posUVZ = new PXCPoint3DF32[wxhDepth];
      pxcU16 *dpixels       = (pxcU16*)depth.planes[0];
      unsigned int dpitch   = depth.pitches[0]/sizeof(pxcU16); /* aligned width */
      if (posUVZ)
      {
         for (unsigned int yy = ybegin, k = 0; yy < yend; yy++)
         {
            for (unsigned int xx = xbegin; xx < xend; xx++, k++)
            {
               posUVZ.x = (pxcF32)xx;
               posUVZ.y = (pxcF32)yy;
               posUVZ.z = (pxcF32) dpixels[yy * dpitch + xx];
            }
         }
       }
      // convert the array of depth coordinates + depth value (posUVZ) into the world coordinates (pos3D) in mm
      PXCPoint3DF32* pos3D = new PXCPoint3DF32[wxhDepth];
      if (_projection->ProjectDepthToCamera(wxhDepth, posUVZ, pos3D) < PXC_STATUS_NO_ERROR)
      {
         delete [] posUVZ;
         delete [] pos3D;
         return true;
      }
      delete [] posUVZ;
      delete [] pos3D;
      return false;
   };

 

Responder