From d1f856ffb3b4a15b3b56fa84494d6d7f8f0c759e Mon Sep 17 00:00:00 2001 From: Sebastian Hahta <joseha@utu.fi> Date: Wed, 24 Jul 2019 16:24:49 +0300 Subject: [PATCH] Use meters instead of millimeters in disparity to depth conversions --- applications/calibration/src/common.cpp | 2 +- applications/vision/src/main.cpp | 2 +- components/rgbd-sources/src/algorithms/disp2depth.cu | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/applications/calibration/src/common.cpp b/applications/calibration/src/common.cpp index 69b759eb2..9a44ee28e 100644 --- a/applications/calibration/src/common.cpp +++ b/applications/calibration/src/common.cpp @@ -178,7 +178,7 @@ CalibrationChessboard::CalibrationChessboard(const map<string, string> &opt) { getOptionInt(opt, "rows", 6)); image_size_ = Size( getOptionInt(opt, "width", 1280), getOptionInt(opt, "height", 720)); - pattern_square_size_ = getOptionDouble(opt, "square_size", 36.0); + pattern_square_size_ = getOptionDouble(opt, "square_size", 0.036); LOG(INFO) << "Chessboard calibration parameters"; LOG(INFO) << " rows: " << pattern_size_.height; diff --git a/applications/vision/src/main.cpp b/applications/vision/src/main.cpp index 4c38125ce..1ce6cb162 100644 --- a/applications/vision/src/main.cpp +++ b/applications/vision/src/main.cpp @@ -64,7 +64,7 @@ void disparityToDepth(const cv::Mat &disparity, cv::Mat &depth, const cv::Mat &q cv::Vec4d homg_pt = _Q*cv::Vec4d(x, y, d, 1.0); //dptr[x] = Vec3d(homg_pt.val); //dptr[x] /= homg_pt[3]; - dptr[x] = (homg_pt[2] / homg_pt[3]) / 1000.0f; // Depth in meters + dptr[x] = (homg_pt[2] / homg_pt[3]); // Depth in meters if( fabs(d) <= FLT_EPSILON ) dptr[x] = 1000.0f; diff --git a/components/rgbd-sources/src/algorithms/disp2depth.cu b/components/rgbd-sources/src/algorithms/disp2depth.cu index 72298892d..48e695d97 100644 --- a/components/rgbd-sources/src/algorithms/disp2depth.cu +++ b/components/rgbd-sources/src/algorithms/disp2depth.cu @@ -8,7 +8,7 @@ __global__ void d2d_kernel(cv::cuda::PtrStepSz<float> disp, cv::cuda::PtrStepSz< for (STRIDE_Y(v,disp.rows)) { for (STRIDE_X(u,disp.cols)) { float d = disp(v,u); - depth(v,u) = (d == 0) ? 50.0f : ((cam.baseline*cam.fx) / (d + cam.doffs)) / 1000.0f; + depth(v,u) = (d == 0) ? 50.0f : ((cam.baseline*cam.fx) / (d + cam.doffs)); } } } -- GitLab