From c2ccfa057ec000e5eeb735d4dc4912051088faa3 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nicolas.pope@utu.fi>
Date: Wed, 5 Feb 2020 09:00:00 +0200
Subject: [PATCH] Resolves #317 setting video properties

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

diff --git a/components/rgbd-sources/src/sources/stereovideo/local.cpp b/components/rgbd-sources/src/sources/stereovideo/local.cpp
index 023105bdc..eca500f79 100644
--- a/components/rgbd-sources/src/sources/stereovideo/local.cpp
+++ b/components/rgbd-sources/src/sources/stereovideo/local.cpp
@@ -14,6 +14,8 @@
 #include <opencv2/opencv.hpp>
 #include <opencv2/xphoto.hpp>
 
+#include <ftl/timer.hpp>
+
 using ftl::rgbd::detail::LocalSource;
 using ftl::rgbd::detail::Calibrate;
 using cv::Mat;
@@ -60,14 +62,16 @@ LocalSource::LocalSource(nlohmann::json &config)
 	else {
 		camera_b_->set(cv::CAP_PROP_FRAME_WIDTH, value("width", 640));
 		camera_b_->set(cv::CAP_PROP_FRAME_HEIGHT, value("height", 480));
+		camera_b_->set(cv::CAP_PROP_FPS, 1000 / ftl::timer::getInterval());
+		//camera_b_->set(cv::CAP_PROP_BUFFERSIZE, 0);  // Has no effect
 
 		stereo_ = true;
 	}
 
 	camera_a_->set(cv::CAP_PROP_FRAME_WIDTH, value("width", 640));
 	camera_a_->set(cv::CAP_PROP_FRAME_HEIGHT, value("height", 480));
-	//TODO: CAP_PROP_FPS
-	// CAP_PROP_BUFFERSIZE
+	camera_a_->set(cv::CAP_PROP_FPS, 1000 / ftl::timer::getInterval());
+	//camera_a_->set(cv::CAP_PROP_BUFFERSIZE, 0);  // Has no effect
 	
 	Mat frame;
 	camera_a_->grab();
-- 
GitLab