From faad764f24fc6b0e52270c5a4517bba19a67e59f Mon Sep 17 00:00:00 2001 From: Enrique Fernandez Date: Tue, 5 Mar 2019 18:35:12 +0100 Subject: [PATCH 1/2] Convert depth to meters --- src/sc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sc.cpp b/src/sc.cpp index c7a0e04..a1c4e42 100644 --- a/src/sc.cpp +++ b/src/sc.cpp @@ -238,7 +238,7 @@ struct SessionDelegate : ST::CaptureSessionDelegate { for(int x = 0; x < depthFrame.width(); x++) { std::size_t pixelOffset = (y * depthFrame.width()) + x; - img.at(y, x) = buf[pixelOffset]; + img.at(y, x) = buf[pixelOffset] * 0.001f; } } From 2cec3fdef53bd5a1fd5cca51f485cb84c3d8c98a Mon Sep 17 00:00:00 2001 From: Enrique Fernandez Date: Tue, 5 Mar 2019 18:35:34 +0100 Subject: [PATCH 2/2] Add depth_correction_enable param Defaults to false. --- src/sc.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sc.cpp b/src/sc.cpp index a1c4e42..1f508b3 100644 --- a/src/sc.cpp +++ b/src/sc.cpp @@ -351,6 +351,8 @@ class SCNode bool imu_enable_; + bool depth_correction_enable_; + SessionDelegate *delegate_ = nullptr; ST::CaptureSessionSettings sessionConfig_; ST::CaptureSession captureSession_; @@ -374,6 +376,9 @@ class SCNode ros::param::param("~imu_enable", imu_enable_, false); ROS_INFO_STREAM(NODE_NAME << ": imu_enable = " << imu_enable_); + ros::param::param("~depth_correction_enable", depth_correction_enable_, false); + ROS_INFO_STREAM(NODE_NAME << ": depth_correction_enable = " << depth_correction_enable_); + std::string frame_id; ros::param::param("~frame_id", frame_id, DEFAULT_FRAME_ID); ROS_INFO_STREAM(NODE_NAME << ": frame_id = " << frame_id); @@ -393,6 +398,7 @@ class SCNode sessionConfig_.source = ST::CaptureSessionSourceId::StructureCore; sessionConfig_.structureCore = scConfig; + sessionConfig_.applyExpensiveCorrection = depth_correction_enable_; delegate_ = new SessionDelegate(nh_, frame_id, sessionConfig_); captureSession_.setDelegate(delegate_);