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

Ifdef all optflow code

parent d18854d5
No related branches found
No related tags found
No related merge requests found
Pipeline #13008 passed
#pragma once #pragma once
#include <ftl/config.h>
#ifdef HAVE_OPTFLOW
#include <opencv2/core.hpp> #include <opencv2/core.hpp>
#include <opencv2/core/cuda.hpp> #include <opencv2/core/cuda.hpp>
#include <opencv2/cudaoptflow.hpp> #include <opencv2/cudaoptflow.hpp>
...@@ -28,4 +32,6 @@ private: ...@@ -28,4 +32,6 @@ private:
}; };
} }
} }
\ No newline at end of file
#endif // HAVE_OPTFLOW
...@@ -37,6 +37,7 @@ FixstarsSGM::FixstarsSGM(nlohmann::json &config) : Disparity(config) { ...@@ -37,6 +37,7 @@ FixstarsSGM::FixstarsSGM(nlohmann::json &config) : Disparity(config) {
filter_ = cv::cuda::createDisparityBilateralFilter(max_disp_ << 4, radius, iter); filter_ = cv::cuda::createDisparityBilateralFilter(max_disp_ << 4, radius, iter);
} }
#ifdef HAVE_OPTFLOW
bool use_off_ = value("use_off", false); bool use_off_ = value("use_off", false);
if (use_off_) if (use_off_)
...@@ -45,6 +46,7 @@ FixstarsSGM::FixstarsSGM(nlohmann::json &config) : Disparity(config) { ...@@ -45,6 +46,7 @@ FixstarsSGM::FixstarsSGM(nlohmann::json &config) : Disparity(config) {
double off_threshold = value("off_threshold", 0.9); double off_threshold = value("off_threshold", 0.9);
off_ = ftl::rgbd::OFDisparityFilter(size_, off_size, off_threshold); off_ = ftl::rgbd::OFDisparityFilter(size_, off_size, off_threshold);
} }
#endif
init(size_); init(size_);
} }
...@@ -105,11 +107,13 @@ void FixstarsSGM::compute(const cv::cuda::GpuMat &l, const cv::cuda::GpuMat &r, ...@@ -105,11 +107,13 @@ void FixstarsSGM::compute(const cv::cuda::GpuMat &l, const cv::cuda::GpuMat &r,
dispt_full_res_.convertTo(disp, CV_32F, 1.0f / 16.0f, stream); dispt_full_res_.convertTo(disp, CV_32F, 1.0f / 16.0f, stream);
#ifdef HAVE_OPTFLOW
if (use_off_) { if (use_off_) {
Mat disp_host(disp); Mat disp_host(disp);
off_.filter(disp_host, Mat(lbw_)); off_.filter(disp_host, Mat(lbw_));
disp.upload(disp_host); disp.upload(disp_host);
} }
#endif
} }
void FixstarsSGM::setMask(Mat &mask) { void FixstarsSGM::setMask(Mat &mask) {
......
...@@ -53,7 +53,10 @@ namespace ftl { ...@@ -53,7 +53,10 @@ namespace ftl {
cv::cuda::GpuMat l_downscaled_; cv::cuda::GpuMat l_downscaled_;
cv::cuda::GpuMat dispt_full_res_; cv::cuda::GpuMat dispt_full_res_;
#ifdef HAVE_OPTFLOW
ftl::rgbd::OFDisparityFilter off_; ftl::rgbd::OFDisparityFilter off_;
#endif
}; };
}; };
}; };
......
#ifdef HAVE_OPTFLOW
#include <loguru.hpp> #include <loguru.hpp>
#include "ftl/offilter.hpp" #include "ftl/offilter.hpp"
...@@ -107,3 +109,5 @@ void OFDisparityFilter::filter(Mat &disp, const Mat &gray) ...@@ -107,3 +109,5 @@ void OFDisparityFilter::filter(Mat &disp, const Mat &gray)
} }
} }
} }
#endif // HAVE_OPTFLOW
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