11 Replies Latest reply on Jan 16, 2018 4:08 PM by Intel Corporation

    R200 noisy point cloud, calibrator throws error


      I use R200 camera with librealsense and PCL 1.8.0 on UP Board with Lubuntu 16.04.3 LTS. I fill the point cloud with points from the camera with following code (how do I do code formatting here?):


      int main() {

          pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>(DEPTH_IMG_WIDTH, DEPTH_IMG_HEIGHT));

          //RealSense init


          //rs::log_to_file(rs::log_severity::debug, "librealsense.log");



          // Create a context object. This object owns the handles to all connected realsense devices.

          rs::context ctx;

          printf("There are %d connected RealSense devices.\n", ctx.get_device_count());

          if (ctx.get_device_count() == 0) return EXIT_FAILURE;



          rs::device *dev = ctx.get_device(0);

          printf("\nUsing device 0, an %s\n", dev->get_name());

          printf("    Serial number: %s\n", dev->get_serial());

          printf("    Firmware version: %s\n", dev->get_firmware_version());



          dev->enable_stream(rs::stream::depth, DEPTH_IMG_WIDTH, DEPTH_IMG_HEIGHT, rs::format::z16, 60);




          while (true) {




              const uint16_t *depthImage = (const uint16_t *) dev->get_frame_data(rs::stream::depth);

              rs::intrinsics depthIntrin = dev->get_stream_intrinsics(rs::stream::depth);

              float scale = dev->get_depth_scale();



              int dw = depthIntrin.width;

              int dh = depthIntrin.height;

              int dwh = dw * dh;



              // Set up the clouds to be used




              cloud->width = DEPTH_IMG_WIDTH;

              cloud->height = DEPTH_IMG_HEIGHT;






              cloud->is_dense = false;







              for (int dy = 0; dy < dh; dy++) {

                  for (int dx = 0; dx < dw; dx++) {

                      uint16_t depthValue = depthImage[dy * depthIntrin.width + dx];



                      float depth_in_meters = depthValue * scale;



                      if (depthValue == 0) continue;



                      rs::float2 depthPixel = {(float) dx, (float) dy};

                      rs::float3 depthPoint = depthIntrin.deproject(depthPixel, depth_in_meters);

                      cloud->points[dy * dw + dx] = pcl::PointXYZ(depthPoint.x, depthPoint.y,




              //Visualization and PCL processing...




      Flat surfaces on the point cloud I get are "wavy":


      When I try to run camera calibrator on windows, I get "INVALID_DS_ARG" error, even windows reinstall doesn't help.