From bd655dbcb28b556b787d576865276494289d2e74 Mon Sep 17 00:00:00 2001
From: Sebastian Hahta <joseha@utu.fi>
Date: Thu, 12 Dec 2019 11:00:54 +0200
Subject: [PATCH] fix left channel parameters (resolution)

---
 .../src/sources/stereovideo/stereovideo.cpp   | 36 ++++++++++---------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/components/rgbd-sources/src/sources/stereovideo/stereovideo.cpp b/components/rgbd-sources/src/sources/stereovideo/stereovideo.cpp
index 01afccee4..5b94356c6 100644
--- a/components/rgbd-sources/src/sources/stereovideo/stereovideo.cpp
+++ b/components/rgbd-sources/src/sources/stereovideo/stereovideo.cpp
@@ -151,25 +151,29 @@ void StereoVideoSource::init(const string &file) {
 }
 
 ftl::rgbd::Camera StereoVideoSource::parameters(Channel chan) {
+	cv::Mat q;
+	
 	if (chan == Channel::Right) {
-		cv::Mat q = calib_->getCameraMatrixRight(depth_size_);
-		ftl::rgbd::Camera params = {
-			q.at<double>(0,0),	// Fx
-			q.at<double>(1,1),	// Fy
-			-q.at<double>(0,2),	// Cx
-			-q.at<double>(1,2),	// Cy
-			(unsigned int)lsrc_->width(),
-			(unsigned int)lsrc_->height(),
-			0.0f,	// 0m min
-			15.0f,	// 15m max
-			1.0 / calib_->getQ().at<double>(3,2), // Baseline
-			0.0f  // doffs
-		};
-		return params;
-		//params_.doffs = -calib_->getQ().at<double>(3,3) * params_.baseline;
+		q = calib_->getCameraMatrixRight(depth_size_);
 	} else {
-		return params_;
+		q = calib_->getCameraMatrixLeft(depth_size_);
 	}
+
+	// TODO: remove hardcoded values (min/max)
+	ftl::rgbd::Camera params = {
+		q.at<double>(0,0),	// Fx
+		q.at<double>(1,1),	// Fy
+		-q.at<double>(0,2),	// Cx
+		-q.at<double>(1,2),	// Cy
+		(unsigned int)lsrc_->width(),
+		(unsigned int)lsrc_->height(),
+		0.0f,	// 0m min
+		15.0f,	// 15m max
+		1.0 / calib_->getQ().at<double>(3,2), // Baseline
+		0.0f  // doffs
+	};
+	
+	return params;
 }
 
 bool StereoVideoSource::capture(int64_t ts) {
-- 
GitLab