From bf6dfb953292b7c5befdc0837aa44b0a69253a05 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Mon, 10 Jun 2019 08:24:37 +0300 Subject: [PATCH] Fix for camera device bug --- components/rgbd-sources/src/stereovideo.cpp | 18 +++++++++++------- components/rgbd-sources/src/stereovideo.hpp | 2 ++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/components/rgbd-sources/src/stereovideo.cpp b/components/rgbd-sources/src/stereovideo.cpp index 07cc16885..8c3e49608 100644 --- a/components/rgbd-sources/src/stereovideo.cpp +++ b/components/rgbd-sources/src/stereovideo.cpp @@ -15,12 +15,22 @@ using std::unique_lock; StereoVideoSource::StereoVideoSource(ftl::rgbd::Source *host) : ftl::rgbd::detail::Source(host) { - + init(""); } StereoVideoSource::StereoVideoSource(ftl::rgbd::Source *host, const string &file) : ftl::rgbd::detail::Source(host), ready_(false) { + init(file); +} + +StereoVideoSource::~StereoVideoSource() { + delete disp_; + delete calib_; + delete lsrc_; +} + +void StereoVideoSource::init(const string &file) { if (ftl::is_video(file)) { // Load video file LOG(INFO) << "Using video file..."; @@ -77,12 +87,6 @@ StereoVideoSource::StereoVideoSource(ftl::rgbd::Source *host, const string &file ready_ = true; } -StereoVideoSource::~StereoVideoSource() { - delete disp_; - delete calib_; - delete lsrc_; -} - static void disparityToDepth(const cv::Mat &disparity, cv::Mat &depth, const cv::Mat &q) { cv::Matx44d _Q; q.convertTo(_Q, CV_64F); diff --git a/components/rgbd-sources/src/stereovideo.hpp b/components/rgbd-sources/src/stereovideo.hpp index 8b07e8764..7979b25bc 100644 --- a/components/rgbd-sources/src/stereovideo.hpp +++ b/components/rgbd-sources/src/stereovideo.hpp @@ -39,6 +39,8 @@ class StereoVideoSource : public detail::Source { cv::Mat left_; cv::Mat right_; cv::Mat mask_l_; + + void init(const std::string &); }; } -- GitLab