From 6a88c2bbe6a616cf3843e3317733434e685e9a4c Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Sun, 3 Nov 2019 17:35:05 +0200
Subject: [PATCH] Remove use of depth entirely

---
 components/operators/src/smoothchan.cu      | 6 +++---
 components/operators/src/smoothing.cpp      | 6 +++---
 components/operators/src/smoothing_cuda.hpp | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/components/operators/src/smoothchan.cu b/components/operators/src/smoothchan.cu
index 08fc3cb43..af9ec3524 100644
--- a/components/operators/src/smoothchan.cu
+++ b/components/operators/src/smoothchan.cu
@@ -24,7 +24,7 @@ __global__ void smooth_chan_kernel(
 		// A distance has already been found
 		if (smoothing_out(x,y) < 1.0f) return;
 
-		float mindist = 50.0f;
+		float mindist = 100.0f;
 
 		const uchar4 c0 = colour_in.tex2D(ix, iy);
 		//const float d0 = depth_in.tex2D(ix, iy);
@@ -46,13 +46,13 @@ __global__ void smooth_chan_kernel(
 			}
 		}
 
-		smoothing_out(x,y) = min(mindist / 50.0f, 1.0f);
+		smoothing_out(x,y) = min(mindist / 100.0f, 1.0f);
 	}
 }
 
 void ftl::cuda::smooth_channel(
 		ftl::cuda::TextureObject<uchar4> &colour_in,
-		ftl::cuda::TextureObject<float> &depth_in,
+		//ftl::cuda::TextureObject<float> &depth_in,
 		ftl::cuda::TextureObject<float> &smoothing_out,
 		const ftl::rgbd::Camera &camera,
 		float alpha,
diff --git a/components/operators/src/smoothing.cpp b/components/operators/src/smoothing.cpp
index bb3b70677..77259b8de 100644
--- a/components/operators/src/smoothing.cpp
+++ b/components/operators/src/smoothing.cpp
@@ -85,7 +85,7 @@ bool SmoothChannel::apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, ftl::rgbd
 	// Reduce to nearest
 	ftl::cuda::smooth_channel(
 		in.createTexture<uchar4>(Channel::Colour),
-		in.createTexture<float>(Channel::Depth),
+		//in.createTexture<float>(Channel::Depth),
 		out.createTexture<float>(Channel::Smoothing),
 		s->parameters(),
 		threshold,
@@ -103,11 +103,11 @@ bool SmoothChannel::apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, ftl::rgbd
 
 		// Downscale images for next pass
 		cv::cuda::resize(in.get<GpuMat>(Channel::Colour), temp_[i].create<GpuMat>(Channel::Colour), cv::Size(width, height), 0.0, 0.0, cv::INTER_LINEAR);
-		cv::cuda::resize(in.get<GpuMat>(Channel::Depth), temp_[i].create<GpuMat>(Channel::Depth), cv::Size(width, height), 0.0, 0.0, cv::INTER_NEAREST);
+		//cv::cuda::resize(in.get<GpuMat>(Channel::Depth), temp_[i].create<GpuMat>(Channel::Depth), cv::Size(width, height), 0.0, 0.0, cv::INTER_NEAREST);
 
 		ftl::cuda::smooth_channel(
 			temp_[i].createTexture<uchar4>(Channel::Colour),
-			temp_[i].createTexture<float>(Channel::Depth),
+			//temp_[i].createTexture<float>(Channel::Depth),
 			out.getTexture<float>(Channel::Smoothing),
 			scaledCam,
 			threshold,
diff --git a/components/operators/src/smoothing_cuda.hpp b/components/operators/src/smoothing_cuda.hpp
index 1b5079d1c..67de60801 100644
--- a/components/operators/src/smoothing_cuda.hpp
+++ b/components/operators/src/smoothing_cuda.hpp
@@ -31,7 +31,7 @@ void colour_mls_smooth(
 
 void smooth_channel(
 		ftl::cuda::TextureObject<uchar4> &colour_in,
-		ftl::cuda::TextureObject<float> &depth_in,
+		//ftl::cuda::TextureObject<float> &depth_in,
 		ftl::cuda::TextureObject<float> &smoothing_out,
 		const ftl::rgbd::Camera &camera,
 		float alpha,
-- 
GitLab