Skip to content
Snippets Groups Projects
Commit e2f8c986 authored by Sebastian Hahta's avatar Sebastian Hahta
Browse files

camera params to depth resolution

parent f35c5048
No related branches found
No related tags found
1 merge request!196High resolution colour
Pipeline #16768 passed
......@@ -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);
}
......
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment