From 7a0724d61744963eb258d9ab910dcd025629dd3a Mon Sep 17 00:00:00 2001 From: Sebastian Hahta <joseha@utu.fi> Date: Wed, 22 May 2019 12:33:44 +0300 Subject: [PATCH] libSGM bad disparity hack --- .../rgbd-sources/src/algorithms/fixstars_sgm.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/components/rgbd-sources/src/algorithms/fixstars_sgm.cpp b/components/rgbd-sources/src/algorithms/fixstars_sgm.cpp index 4274af033..5c846acee 100644 --- a/components/rgbd-sources/src/algorithms/fixstars_sgm.cpp +++ b/components/rgbd-sources/src/algorithms/fixstars_sgm.cpp @@ -33,9 +33,12 @@ void FixstarsSGM::compute(const cv::Mat &l, const cv::Mat &r, cv::Mat &disp) { //std::chrono::duration<double> elapsed = // std::chrono::high_resolution_clock::now() - start; //LOG(INFO) << "CUDA sgm in " << elapsed.count() << "s"; - + + // todo: fix libSGM (return float data or provide mask separately) + // (256 << 5) coded in libSGM consistency check + Mat bad_pixels = (disp == (256 << 5)); disp.convertTo(disp, CV_32F, 1.0f/16.0f); -} - - - + disp.setTo(0, bad_pixels); // decide how bad values should be represented + + disp.convertTo(disp, CV_32F, 1.0f/16.0f); +} \ No newline at end of file -- GitLab