From cf13ff8cce884d8f4eb39f8d5679800bc426add3 Mon Sep 17 00:00:00 2001
From: Sebastian Hahta <joseha@utu.fi>
Date: Fri, 1 Nov 2019 12:52:28 +0200
Subject: [PATCH] apply optical flow filter before bilateral

---
 components/rgbd-sources/src/algorithms/fixstars_sgm.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/components/rgbd-sources/src/algorithms/fixstars_sgm.cpp b/components/rgbd-sources/src/algorithms/fixstars_sgm.cpp
index 8a55fbcbb..a8a4982c7 100644
--- a/components/rgbd-sources/src/algorithms/fixstars_sgm.cpp
+++ b/components/rgbd-sources/src/algorithms/fixstars_sgm.cpp
@@ -205,6 +205,10 @@ void FixstarsSGM::compute(ftl::rgbd::Frame &frame, cv::cuda::Stream &stream)
 	left_pixels.setTo(0);
 	cv::cuda::threshold(dispt_, dispt_, 4096.0f, 0.0f, cv::THRESH_TOZERO_INV, stream);
 
+	#ifdef HAVE_OPTFLOW
+		if (use_off_) { off_.filter(frame, stream); }
+	#endif
+
 	// TODO: filter could be applied after upscaling (to the upscaled disparity image)
 	if (use_filter_)
 	{
@@ -228,9 +232,6 @@ void FixstarsSGM::compute(ftl::rgbd::Frame &frame, cv::cuda::Stream &stream)
 
 	dispt_scaled.convertTo(disp, CV_32F, 1.0f / 16.0f, stream);
 
-#ifdef HAVE_OPTFLOW
-	if (use_off_) { off_.filter(frame, stream); }
-#endif
 }
 
 void FixstarsSGM::setMask(Mat &mask) {
-- 
GitLab