diff --git a/components/rgbd-sources/src/stereovideo.cpp b/components/rgbd-sources/src/stereovideo.cpp index 07cc168852e725d5874b81656119da8a68b373e5..8c3e49608c92b45c5dcf648f8c7890619e71f4c9 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 8b07e876477377a35f851de4b846cd02690f13de..7979b25bc781a19ad650206b259a2575d07e4d7c 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 &); }; }