diff --git a/modules/rgbd/include/opencv2/rgbd/depth.hpp b/modules/rgbd/include/opencv2/rgbd/depth.hpp index 0fcd5ce7d..a50af0e1c 100755 --- a/modules/rgbd/include/opencv2/rgbd/depth.hpp +++ b/modules/rgbd/include/opencv2/rgbd/depth.hpp @@ -312,16 +312,17 @@ namespace rgbd depthTo3d(InputArray depth, InputArray K, OutputArray points3d, InputArray mask = noArray()); /** If the input image is of type CV_16UC1 (like the Kinect one), the image is converted to floats, divided - * by 1000 to get a depth in meters, and the values 0 are converted to std::numeric_limits::quiet_NaN() + * by depth_factor to get a depth in meters, and the values 0 are converted to std::numeric_limits::quiet_NaN() * Otherwise, the image is simply converted to floats * @param in the depth image (if given as short int CV_U, it is assumed to be the depth in millimeters * (as done with the Microsoft Kinect), it is assumed in meters) * @param depth the desired output depth (floats or double) * @param out The rescaled float depth image + * @param depth_factor (optional) factor by which depth is converted to distance (by default = 1000.0 for Kinect sensor) */ CV_EXPORTS_W void - rescaleDepth(InputArray in, int depth, OutputArray out); + rescaleDepth(InputArray in, int depth, OutputArray out, double depth_factor = 1000.0); /** Object that can compute planes in an image */ diff --git a/modules/rgbd/include/opencv2/rgbd/dynafu.hpp b/modules/rgbd/include/opencv2/rgbd/dynafu.hpp index fae69c48e..55fe36d7e 100644 --- a/modules/rgbd/include/opencv2/rgbd/dynafu.hpp +++ b/modules/rgbd/include/opencv2/rgbd/dynafu.hpp @@ -13,6 +13,7 @@ #include "kinfu.hpp" namespace cv { + namespace dynafu { /** @brief DynamicFusion implementation @@ -37,6 +38,11 @@ namespace dynafu { That's why you need to set the OPENCV_ENABLE_NONFREE option in CMake to use DynamicFusion. */ + + +/** Backwards compatibility for old versions */ +using Params = kinfu::Params; + class CV_EXPORTS_W DynaFu { public: diff --git a/modules/rgbd/src/utils.cpp b/modules/rgbd/src/utils.cpp index 30c8aa153..b91a88d4d 100644 --- a/modules/rgbd/src/utils.cpp +++ b/modules/rgbd/src/utils.cpp @@ -22,7 +22,7 @@ namespace rgbd * @param out_out The rescaled float depth image */ void - rescaleDepth(InputArray in_in, int depth, OutputArray out_out) + rescaleDepth(InputArray in_in, int depth, OutputArray out_out, double depth_factor) { cv::Mat in = in_in.getMat(); CV_Assert(in.type() == CV_64FC1 || in.type() == CV_32FC1 || in.type() == CV_16UC1 || in.type() == CV_16SC1); @@ -34,13 +34,13 @@ namespace rgbd cv::Mat out = out_out.getMat(); if (in_depth == CV_16U) { - in.convertTo(out, depth, 1 / 1000.0); //convert to float so that it is in meters + in.convertTo(out, depth, 1 / depth_factor); //convert to float so that it is in meters cv::Mat valid_mask = in == std::numeric_limits::min(); // Should we do std::numeric_limits::max() too ? out.setTo(std::numeric_limits::quiet_NaN(), valid_mask); //set a$ } if (in_depth == CV_16S) { - in.convertTo(out, depth, 1 / 1000.0); //convert to float so tha$ + in.convertTo(out, depth, 1 / depth_factor); //convert to float so tha$ cv::Mat valid_mask = (in == std::numeric_limits::min()) | (in == std::numeric_limits::max()); // Should we do std::numeric_limits::max() too ? out.setTo(std::numeric_limits::quiet_NaN(), valid_mask); //set a$ }