12 Replies Latest reply on Jun 25, 2018 4:55 AM by baptiste-mnh

    Converting RealSense Pointcloud to PCL Pointcloud


      Hello everyone,


      I know this has been questioned few times, but I would like to make this clear - not only for me, but for everyone trying to implement this.


      What I am trying to do is basically to convert the pointcloud data from RealSense camera (D415) to PCD format, which is conventional in PCL (pointcloud library). By saying pointcloud data, I mean depth data + RGB data - if you combine these two you get exactly the same as in realsense viewer, when you hit the 3D button.


      What I have accomplished so far: I succesfully converted depth frame - thanks to the PCL Wrapper librealsense/wrappers/pcl at master · IntelRealSense/librealsense · GitHub


      This is how I am accesing XYZ values of points - so the depth values

      p.x = ptr->x;
      p.y = ptr->y;
      p.z = ptr->z;


      Where p is pcl::PointCloud<pcl::PointXYZRGB> object and ptr is pointing to rs2::points.get_vertices(). Also I know I can access the RGB values just like XYZ, so p.r and so.


      So what my greatest "wish" is - is to provide solution for me (   ) and of course for the others - maybe contribute to PCL wrapper in librealsense library - so the depth and color data from RS cameras would be easily convertible to PCD format. I am developing on Ubuntu.


      I know how depth data is stored, at least I think I understand it - XYZ values of a single point are the coordinates (in meters), where [0,0,0] point is the camera base. 


      Little bit of background of my work, if you are interested. I am willing to create 3D map by registering a number of pointcloud datasets (frames). I would like to do this on the keypoints principle, that means I would like to apply SIFT algorithm - that is why I need to know correspondence between XYZ and RGB values of points in the pointcloud.