Skip to content
Snippets Groups Projects
Commit 2d1a7124 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Merge branch 'master' of gitlab.utu.fi:nicolas.pope/ftl

parents 42d1c67a fef3385c
No related branches found
No related tags found
No related merge requests found
Pipeline #11853 passed
...@@ -12,9 +12,8 @@ using cv::cuda::GpuMat; ...@@ -12,9 +12,8 @@ using cv::cuda::GpuMat;
FixstarsSGM::FixstarsSGM(nlohmann::json &config) : Disparity(config) { FixstarsSGM::FixstarsSGM(nlohmann::json &config) : Disparity(config) {
ssgm_ = nullptr; ssgm_ = nullptr;
uniqueness_ = value("uniqueness", 0.95f);
use_filter_ = value("use_filter", false); use_filter_ = value("use_filter", false);
// note: (max_disp_ << 4) libsgm subpixel accuracy.
// What is the impact in the filter? (possible artifacts)
filter_ = cv::cuda::createDisparityBilateralFilter(max_disp_ << 4, value("filter_radius", 25), value("filter_iter", 1)); filter_ = cv::cuda::createDisparityBilateralFilter(max_disp_ << 4, value("filter_radius", 25), value("filter_iter", 1));
} }
...@@ -26,7 +25,7 @@ void FixstarsSGM::compute(const cv::cuda::GpuMat &l, const cv::cuda::GpuMat &r, ...@@ -26,7 +25,7 @@ void FixstarsSGM::compute(const cv::cuda::GpuMat &l, const cv::cuda::GpuMat &r,
if (!ssgm_) { // todo: move to constructor if (!ssgm_) { // todo: move to constructor
dispt_ = GpuMat(l.rows, l.cols, CV_16SC1); dispt_ = GpuMat(l.rows, l.cols, CV_16SC1);
ssgm_ = new sgm::StereoSGM(l.cols, l.rows, max_disp_, 8, 16, lbw_.step, dispt_.step / sizeof(short), ssgm_ = new sgm::StereoSGM(l.cols, l.rows, max_disp_, 8, 16, lbw_.step, dispt_.step / sizeof(short),
sgm::EXECUTE_INOUT_CUDA2CUDA, sgm::StereoSGM::Parameters(10,120,0.95f,true)); sgm::EXECUTE_INOUT_CUDA2CUDA, sgm::StereoSGM::Parameters(10, 120, uniqueness_, true));
} }
//auto start = std::chrono::high_resolution_clock::now(); //auto start = std::chrono::high_resolution_clock::now();
...@@ -62,7 +61,7 @@ void FixstarsSGM::setMask(Mat &mask) { ...@@ -62,7 +61,7 @@ void FixstarsSGM::setMask(Mat &mask) {
if (!ssgm_) { // todo: move to constructor if (!ssgm_) { // todo: move to constructor
ssgm_ = new sgm::StereoSGM(mask.cols, mask.rows, max_disp_, 8, 16, ssgm_ = new sgm::StereoSGM(mask.cols, mask.rows, max_disp_, 8, 16,
sgm::EXECUTE_INOUT_HOST2HOST, sgm::EXECUTE_INOUT_HOST2HOST,
sgm::StereoSGM::Parameters(10,120,0.95f,true)); sgm::StereoSGM::Parameters(10, 120, uniqueness_, true));
} }
mask_l_ = mask; mask_l_ = mask;
......
...@@ -35,6 +35,7 @@ class FixstarsSGM : public ftl::rgbd::detail::Disparity { ...@@ -35,6 +35,7 @@ class FixstarsSGM : public ftl::rgbd::detail::Disparity {
} }
private: private:
float uniqueness_;
bool use_filter_; bool use_filter_;
cv::Ptr<cv::cuda::DisparityBilateralFilter> filter_; cv::Ptr<cv::cuda::DisparityBilateralFilter> filter_;
sgm::StereoSGM *ssgm_; sgm::StereoSGM *ssgm_;
......
...@@ -282,9 +282,14 @@ void Streamer::_schedule() { ...@@ -282,9 +282,14 @@ void Streamer::_schedule() {
auto start = std::chrono::high_resolution_clock::now(); auto start = std::chrono::high_resolution_clock::now();
try { try {
src->src->grab(); src->src->grab();
} catch (...) { } catch (std::exception &ex) {
LOG(ERROR) << "Exception when grabbing frame"; LOG(ERROR) << "Exception when grabbing frame";
LOG(ERROR) << ex.what();
} }
catch (...) {
LOG(ERROR) << "Unknown exception when grabbing frame";
}
std::chrono::duration<double> elapsed = std::chrono::duration<double> elapsed =
std::chrono::high_resolution_clock::now() - start; std::chrono::high_resolution_clock::now() - start;
LOG(INFO) << "Grab in " << elapsed.count() << "s"; LOG(INFO) << "Grab in " << elapsed.count() << "s";
......
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