From f147be2c58b64f9b4ae411e5731455123a30afdf Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Mon, 1 Jul 2019 20:50:16 +0300
Subject: [PATCH] Correction to correction

---
 components/rgbd-sources/src/middlebury_source.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/components/rgbd-sources/src/middlebury_source.cpp b/components/rgbd-sources/src/middlebury_source.cpp
index 89bb253c1..463491439 100644
--- a/components/rgbd-sources/src/middlebury_source.cpp
+++ b/components/rgbd-sources/src/middlebury_source.cpp
@@ -86,6 +86,7 @@ MiddleburySource::MiddleburySource(ftl::rgbd::Source *host, const string &dir)
 	host_->getConfig()["centre_x"] = params_.cx;
 	host_->getConfig()["centre_y"] = params_.cy;
 	host_->getConfig()["baseline"] = params_.baseline;
+	host_->getConfig()["doffs"] = params_.doffs;
 
 	// Add event handlers to allow calibration changes...
 	host_->on("baseline", [this](const ftl::config::Event &e) {
@@ -97,6 +98,10 @@ MiddleburySource::MiddleburySource(ftl::rgbd::Source *host, const string &dir)
 		params_.fy = params_.fx;
 	});
 
+	host_->on("doffs", [this](const ftl::config::Event &e) {
+		params_.doffs = host_->value("doffs", params_.doffs);
+	});
+
 	host_->on("centre_x", [this](const ftl::config::Event &e) {
 		params_.cx = host_->value("centre_x", params_.cx);
 	});
@@ -137,7 +142,6 @@ MiddleburySource::MiddleburySource(ftl::rgbd::Source *host, const string &dir)
 }
 
 static void disparityToDepth(const cv::cuda::GpuMat &disparity, cv::cuda::GpuMat &depth,
-							 const cv::cuda::GpuMat &mask,
 							 const ftl::rgbd::Camera &c, cv::cuda::Stream &stream) {
 	double val = c.baseline * c.fx;
 	cv::cuda::add(disparity, c.doffs, depth, cv::noArray(), -1, stream);
@@ -190,7 +194,7 @@ void MiddleburySource::_performDisparity() {
 }
 
 bool MiddleburySource::grab(int n, int b) {
-	//_performDisparity();
+	_performDisparity();
 	return true;
 }
 
-- 
GitLab