From 252e6258336345b82d3a9f9de564be7b1f9842f3 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Mon, 16 Sep 2019 13:17:52 +0300
Subject: [PATCH] Create channels in stereovideo

---
 components/rgbd-sources/src/stereovideo.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/components/rgbd-sources/src/stereovideo.cpp b/components/rgbd-sources/src/stereovideo.cpp
index ea824a037..389b622e1 100644
--- a/components/rgbd-sources/src/stereovideo.cpp
+++ b/components/rgbd-sources/src/stereovideo.cpp
@@ -176,8 +176,8 @@ bool StereoVideoSource::capture(int64_t ts) {
 bool StereoVideoSource::retrieve() {
 	auto &frame = frames_[0];
 	frame.reset();
-	auto &left = frame.get<cv::cuda::GpuMat>(Channel::Left);
-	auto &right = frame.get<cv::cuda::GpuMat>(Channel::Right);
+	auto &left = frame.create<cv::cuda::GpuMat>(Channel::Left);
+	auto &right = frame.create<cv::cuda::GpuMat>(Channel::Right);
 	lsrc_->get(left, right, calib_, stream2_);
 
 #ifdef HAVE_OPTFLOW
@@ -185,8 +185,8 @@ bool StereoVideoSource::retrieve() {
 	
 	if (use_optflow_)
 	{
-		auto &left_gray = frame.get<cv::cuda::GpuMat>(Channel::LeftGray);
-		auto &right_gray = frame.get<cv::cuda::GpuMat>(Channel::RightGray);
+		auto &left_gray = frame.create<cv::cuda::GpuMat>(Channel::LeftGray);
+		auto &right_gray = frame.create<cv::cuda::GpuMat>(Channel::RightGray);
 
 		cv::cuda::cvtColor(left, left_gray, cv::COLOR_BGR2GRAY, 0, stream2_);
 		cv::cuda::cvtColor(right, right_gray, cv::COLOR_BGR2GRAY, 0, stream2_);
@@ -226,7 +226,7 @@ bool StereoVideoSource::compute(int n, int b) {
 		disp_->compute(frame, stream_);
 		
 		auto &disp = frame.get<cv::cuda::GpuMat>(Channel::Disparity);
-		auto &depth = frame.get<cv::cuda::GpuMat>(Channel::Depth);
+		auto &depth = frame.create<cv::cuda::GpuMat>(Channel::Depth);
 		if (depth.empty()) depth = cv::cuda::GpuMat(left.size(), CV_32FC1);
 
 		ftl::cuda::disparity_to_depth(disp, depth, params_, stream_);
-- 
GitLab