weixin_39728544
weixin_39728544
2021-01-11 20:10

D435 projector fails to turn on using set_option

| Required Info | | |---------------------------------|------------------------------------------- | | Camera Model | D435 | | Firmware Version | 05.08.15.00 | | Operating System & Version | Ubuntu 16.04 | | Kernel Version (Linux Only) | | | Platform | PC | | SDK Version | v2.10.1 |

Issue Description

We are having issues with turning on the D435 projector using the set_option command. This command succeeds but the images have no pattern on them. Doing the same thing works perfectly on D415 device. Below is a code sample of how we start the streams and enable the projector. We request depth resolution of 1280x720 which is max that is supported for depth images and 1920x1080 for rgb.

c++
rs2::config config;
config.enable_device(params.serial_no);
config.enable_stream(RS2_STREAM_INFRARED, 1, params.depth_width,
                       params.depth_height, RS2_FORMAT_Y8, params.depth_fps);
config.enable_stream(RS2_STREAM_INFRARED, 2, params.depth_width,
                       params.depth_height, RS2_FORMAT_Y8, params.depth_fps);
config.enable_stream(RS2_STREAM_DEPTH, -1, params.depth_width,
                       params.depth_height, RS2_FORMAT_ANY, params.depth_fps);
config.enable_stream(RS2_STREAM_COLOR, -1, params.rgb_width,
                       params.rgb_height, RS2_FORMAT_BGR8, params.rgb_fps);

rs2::pipeline pipe;
if (!config.can_resolve(pipe)) {
  LOG(INFO) << "Cant resolve this config.";
}

rs2::pipeline_profile pipe_profile = config.resolve(pipe);
rs2::device device = pipe_profile.get_device();
std::vector<:sensor> sensors = device.query_sensors();

for (rs2::sensor element : sensors) {
  std::string module_name = element.get_info(RS2_CAMERA_INFO_NAME);
  if ("Stereo Module" == module_name) {
    constexpr size_t kEmitterEnabled = 1u;
    element.set_option(rs2_option::RS2_OPTION_EMITTER_ENABLED,
                       kEmitterEnabled);
  }
}
pipe.start(config);

cv::Mat image( params.depth_height,  params.depth_width, CV_16UC1);
// Wait for several frames for stable stream.
for (size_t i = 0u; i < 20u; ++i) {
  pipe->wait_for_frames();
}
rs2::frameset frames = pipe->wait_for_frames();
constexpr int kStreamIndex = 1u;
rs2::frame frame = frames.get_infrared_frame(kStreamIndex);

if (!frame) continue;
for (size_t x = 0u; x < params.depth_width; ++x) {
    for (size_t y = 0u; y < params.depth_height; ++y) {
      image.at<uint16_t>(y, x) =
              ((uint16_t*)frame.get_data())[y * params.depth_width + x];
    }
}

pipe.stop();
</uint16_t></:sensor>

The strange thing is that if I call the get_option right after turning on the emitter or after the actual frame capture it says it is on while it actually isnt. After this we stop the streams and set them up again, but this time only the IR streams (no depth or color) and at full resolution (1280x800) and in this case we get images that include the projection pattern. I tried adding additional wait times after setting the projector, capturing multiple frames but nothing seems to help. However when using the official ROS driver this works. Is there some other setting I need to set?

Unrelated question: If we want to maximize accuracy and only need depth ranges between 0.2 and 1m, do you have any recommended settings we should use? I read somewhere that you can get close range depth at an expense of resolution, is this correct?

该提问来源于开源项目:IntelRealSense/librealsense

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

19条回答