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

off filter: gpumat

parent cf13ff8c
No related branches found
No related tags found
1 merge request!157feature/vision parameters
Pipeline #16103 failed
...@@ -17,6 +17,7 @@ public: ...@@ -17,6 +17,7 @@ public:
OFDisparityFilter() : n_max_(0), threshold_(0.0) {} OFDisparityFilter() : n_max_(0), threshold_(0.0) {}
OFDisparityFilter(cv::Size size, int n_frames, float threshold); OFDisparityFilter(cv::Size size, int n_frames, float threshold);
void filter(ftl::rgbd::Frame &frame, cv::cuda::Stream &stream); void filter(ftl::rgbd::Frame &frame, cv::cuda::Stream &stream);
void filter(cv::cuda::GpuMat &disp, cv::cuda::GpuMat &optflow, cv::cuda::Stream &stream);
private: private:
int n_max_; int n_max_;
......
...@@ -154,6 +154,7 @@ bool FixstarsSGM::updateOFDisparityFilter() { ...@@ -154,6 +154,7 @@ bool FixstarsSGM::updateOFDisparityFilter() {
} }
if (enable) { if (enable) {
LOG(INFO) << "Optical flow filter, size: " << off_size << ", threshold: " << off_threshold;
off_ = ftl::rgbd::OFDisparityFilter(size_, off_size, off_threshold); off_ = ftl::rgbd::OFDisparityFilter(size_, off_size, off_threshold);
use_off_ = true; use_off_ = true;
} }
...@@ -206,7 +207,11 @@ void FixstarsSGM::compute(ftl::rgbd::Frame &frame, cv::cuda::Stream &stream) ...@@ -206,7 +207,11 @@ void FixstarsSGM::compute(ftl::rgbd::Frame &frame, cv::cuda::Stream &stream)
cv::cuda::threshold(dispt_, dispt_, 4096.0f, 0.0f, cv::THRESH_TOZERO_INV, stream); cv::cuda::threshold(dispt_, dispt_, 4096.0f, 0.0f, cv::THRESH_TOZERO_INV, stream);
#ifdef HAVE_OPTFLOW #ifdef HAVE_OPTFLOW
if (use_off_) { off_.filter(frame, stream); } if (use_off_) {
frame.upload(Channel::Flow, stream);
stream.waitForCompletion();
off_.filter(dispt_, frame.get<GpuMat>(Channel::Flow), stream);
}
#endif #endif
// TODO: filter could be applied after upscaling (to the upscaled disparity image) // TODO: filter could be applied after upscaling (to the upscaled disparity image)
......
...@@ -39,4 +39,9 @@ void OFDisparityFilter::filter(ftl::rgbd::Frame &frame, cv::cuda::Stream &stream ...@@ -39,4 +39,9 @@ void OFDisparityFilter::filter(ftl::rgbd::Frame &frame, cv::cuda::Stream &stream
ftl::cuda::optflow_filter(disp, optflow, disp_old_, n_max_, threshold_, stream); ftl::cuda::optflow_filter(disp, optflow, disp_old_, n_max_, threshold_, stream);
} }
void OFDisparityFilter::filter(cv::cuda::GpuMat &disp, cv::cuda::GpuMat &optflow, cv::cuda::Stream &stream)
{
ftl::cuda::optflow_filter(disp, optflow, disp_old_, n_max_, threshold_, stream);
}
#endif // HAVE_OPTFLOW #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