diff --git a/components/rgbd-sources/src/source.cpp b/components/rgbd-sources/src/source.cpp index 13cdd5487edf0b7cbc99f7cd9dd7032b43d31185..c757ddc84d0e8023dd847cdbf548c17b79637d57 100644 --- a/components/rgbd-sources/src/source.cpp +++ b/components/rgbd-sources/src/source.cpp @@ -308,22 +308,6 @@ void Source::notify(int64_t ts, cv::cuda::GpuMat &c1, cv::cuda::GpuMat &c2) { impl_->params_ = impl_->params_.scaled(max_width, max_height); } - // Should channel 1 be scaled? - if (c1.cols < max_width || c1.rows < max_height) { - LOG(WARNING) << "Resizing on GPU"; - cv::cuda::resize(c1, c1, cv::Size(max_width, max_height)); - } - - // Should channel 2 be scaled? - if (!c2.empty() && (c2.cols < max_width || c2.rows < max_height)) { - LOG(WARNING) << "Resizing on GPU"; - if (c2.type() == CV_32F) { - cv::cuda::resize(c2, c2, cv::Size(max_width, max_height), 0.0, 0.0, cv::INTER_NEAREST); - } else { - cv::cuda::resize(c2, c2, cv::Size(max_width, max_height)); - } - } - if (callback_) callback_(ts, c1, c2); } diff --git a/components/rgbd-sources/src/sources/stereovideo/stereovideo.cpp b/components/rgbd-sources/src/sources/stereovideo/stereovideo.cpp index b4f365101e3954eaa32d6928444dd80155a1f85e..c2ecf8ff17513d1eb774c5ecf12473ff152b0f5e 100644 --- a/components/rgbd-sources/src/sources/stereovideo/stereovideo.cpp +++ b/components/rgbd-sources/src/sources/stereovideo/stereovideo.cpp @@ -71,7 +71,28 @@ void StereoVideoSource::init(const string &file) { color_size_ = cv::Size(lsrc_->width(), lsrc_->height()); frames_ = std::vector<Frame>(2); - calib_ = ftl::create<Calibrate>(host_, "calibration", color_size_, stream_); + pipeline_input_ = ftl::config::create<ftl::operators::Graph>(host_, "input"); + #ifdef HAVE_OPTFLOW + pipeline_input_->append<ftl::operators::NVOpticalFlow>("optflow"); + #endif + + pipeline_depth_ = ftl::config::create<ftl::operators::Graph>(host_, "disparity"); + depth_size_ = cv::Size( pipeline_depth_->value("width", color_size_.width), + pipeline_depth_->value("height", color_size_.height)); + + pipeline_depth_->append<ftl::operators::FixstarsSGM>("algorithm"); + #ifdef HAVE_OPTFLOW + pipeline_depth_->append<ftl::operators::OpticalFlowTemporalSmoothing>("optflow_filter"); + #endif + pipeline_depth_->append<ftl::operators::DisparityBilateralFilter>("bilateral_filter"); + pipeline_depth_->append<ftl::operators::DisparityToDepth>("calculate_depth"); + pipeline_depth_->append<ftl::operators::ColourChannels>("colour"); // Convert BGR to BGRA + pipeline_depth_->append<ftl::operators::Normals>("normals"); // Estimate surface normals + pipeline_depth_->append<ftl::operators::CrossSupport>("cross"); + pipeline_depth_->append<ftl::operators::DiscontinuityMask>("discontinuity_mask"); + pipeline_depth_->append<ftl::operators::AggreMLS>("mls"); // Perform MLS (using smoothing channel) + + calib_ = ftl::create<Calibrate>(host_, "calibration", depth_size_, stream_); if (!calib_->isCalibrated()) LOG(WARNING) << "Cameras are not calibrated!"; // Generate camera parameters from camera matrix @@ -125,28 +146,6 @@ void StereoVideoSource::init(const string &file) { mask_l_gpu.download(mask_l); mask_l_ = (mask_l == 0); - pipeline_input_ = ftl::config::create<ftl::operators::Graph>(host_, "input"); - #ifdef HAVE_OPTFLOW - pipeline_input_->append<ftl::operators::NVOpticalFlow>("optflow"); - #endif - - pipeline_depth_ = ftl::config::create<ftl::operators::Graph>(host_, "disparity"); - - depth_size_ = cv::Size( pipeline_depth_->value("width", color_size_.width), - pipeline_depth_->value("height", color_size_.height)); - - pipeline_depth_->append<ftl::operators::FixstarsSGM>("algorithm"); - #ifdef HAVE_OPTFLOW - pipeline_depth_->append<ftl::operators::OpticalFlowTemporalSmoothing>("optflow_filter"); - #endif - pipeline_depth_->append<ftl::operators::DisparityBilateralFilter>("bilateral_filter"); - pipeline_depth_->append<ftl::operators::DisparityToDepth>("calculate_depth"); - pipeline_depth_->append<ftl::operators::ColourChannels>("colour"); // Convert BGR to BGRA - pipeline_depth_->append<ftl::operators::Normals>("normals"); // Estimate surface normals - pipeline_depth_->append<ftl::operators::CrossSupport>("cross"); - pipeline_depth_->append<ftl::operators::DiscontinuityMask>("discontinuity_mask"); - pipeline_depth_->append<ftl::operators::AggreMLS>("mls"); // Perform MLS (using smoothing channel) - LOG(INFO) << "StereoVideo source ready..."; ready_ = true; }