Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions modules/rgbd/include/opencv2/rgbd/depth.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<float>::quiet_NaN()
* by depth_factor to get a depth in meters, and the values 0 are converted to std::numeric_limits<float>::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
*/
Expand Down
6 changes: 6 additions & 0 deletions modules/rgbd/include/opencv2/rgbd/dynafu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "kinfu.hpp"

namespace cv {

namespace dynafu {

/** @brief DynamicFusion implementation
Expand All @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions modules/rgbd/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<ushort>::min(); // Should we do std::numeric_limits<ushort>::max() too ?
out.setTo(std::numeric_limits<float>::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<short>::min()) | (in == std::numeric_limits<short>::max()); // Should we do std::numeric_limits<ushort>::max() too ?
out.setTo(std::numeric_limits<float>::quiet_NaN(), valid_mask); //set a$
}
Expand Down