12 Replies Latest reply on Oct 4, 2018 12:16 AM by MartyG

    D435 Depth unexpected interpolation.

    yoichi_goda
      I am developing an application on the D435 camera. I will convert from depth to Point Cloud with the program shown below. Then, the object and the depth of the floor seen behind it are interpolated, and Point Clouds that are arranged in a plane that does not actually exist are generated.
      On the other hand, when using Realsense Viewer, such interpolation can not be seen.
      How can I get depth information not interpolated? Thank you for your cooperation.

       

      // librealsense-2.16.0

      // Visual Studio Professional 2015

       

      const int D435RGB_WIDTH = 640;
      const int D435RGB_HEIGHT = 480;

      const int DEPTH_WIDTH = 640;
      const int DEPTH_HEIGHT = 480;

       

      auto pipe = new rs2::pipeline();

      rs2::pipeline_profile profile;
      rs2::config cfg;
      cfg.enable_stream(RS2_STREAM_COLOR, D435RGB_WIDTH, D435RGB_HEIGHT, RS2_FORMAT_BGR8, 30); // RGB
      cfg.enable_stream(RS2_STREAM_DEPTH, DEPTH_WIDTH, DEPTH_HEIGHT, RS2_FORMAT_Z16, 30); // Depth
      cfg.enable_stream(RS2_STREAM_INFRARED, 1, DEPTH_WIDTH, DEPTH_HEIGHT, RS2_FORMAT_Y8, 30);
      cfg.enable_stream(RS2_STREAM_INFRARED, 2, DEPTH_WIDTH, DEPTH_HEIGHT, RS2_FORMAT_Y8, 30);

       

      profile = pipe->start(cfg);

       

      rs2::device selected_device = profile.get_device();
      std::cout << get_device_name(selected_device) << std::endl;

       

      auto depth_sensor = selected_device.first<rs2::depth_sensor>();

      auto preset_value = RS2_RS400_VISUAL_PRESET_DEFAULT;
      depth_sensor.set_option(RS2_OPTION_VISUAL_PRESET, preset_value);

      if (depth_sensor.supports(RS2_OPTION_LASER_POWER)) {
            auto range = depth_sensor.get_option_range(RS2_OPTION_LASER_POWER);
            depth_sensor.set_option(RS2_OPTION_LASER_POWER, range.max); // Set max power
      }
      if (depth_sensor.supports(RS2_OPTION_ENABLE_AUTO_EXPOSURE)) {
            depth_sensor.set_option(RS2_OPTION_ENABLE_AUTO_EXPOSURE, 0);
      }
      if (depth_sensor.supports(RS2_OPTION_EXPOSURE)) {
            auto exposure_value = 4500.f;
            depth_sensor.set_option(RS2_OPTION_EXPOSURE, exposure_value);
      }

       

      auto frames = pipe->wait_for_frames();
      auto depth = frames.get_depth_frame();

      m_cloud->clear();
      points = pc.calculate(depth);
      auto vertices = points.get_vertices();
      for (int i = 0; i < points.size(); i++) {
            pcl::PointXYZRGB b;

            b.x = vertices[i].x * 1000;
            b.y = vertices[i].y * 1000;
            b.z = vertices[i].z * 1000;
            b.r = 255;
            b.g = 255;
            b.b = 255;

            m_cloud->push_back(b);
      }

       

      myapplication_capture01.png

      realsenseviewer_capture01_crop.png