From 657bd3b177b7641fe3f8af6594c7c5e534ba2811 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Mon, 22 Jul 2019 13:01:13 +0300
Subject: [PATCH] WIP output reset

---
 applications/reconstruct/src/depth_camera.cu | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/applications/reconstruct/src/depth_camera.cu b/applications/reconstruct/src/depth_camera.cu
index 9849ec098..4ba171c8e 100644
--- a/applications/reconstruct/src/depth_camera.cu
+++ b/applications/reconstruct/src/depth_camera.cu
@@ -29,6 +29,9 @@ __global__ void mls_smooth_kernel(ftl::cuda::TextureObject<float> output, HashDa
 	const DepthCameraCUDA &mainCamera = c_cameras[cam];
 
 	if (x < width && y < height) {
+		output(x,y) = 1000.0f;
+		__syncthreads();
+
 		float depth = tex2D<float>(mainCamera.depth2, x, y);
 
 		float3 wpos = make_float3(0.0f);
@@ -67,7 +70,12 @@ __global__ void mls_smooth_kernel(ftl::cuda::TextureObject<float> output, HashDa
 			wpos /= weights;
 		}
 
-		output(x,y) = (weights >= 20.0f) ? (mainCamera.poseInverse * wpos).z : 1000.0f;
+		wpos = mainCamera.poseInverse * wpos;
+		const uint2 screenPos = make_uint2(mainCamera.params.cameraToKinectScreenInt(wpos));
+		if (screenPos.x < output.width() && screenPos.y < output.height()) {
+			output(screenPos.x,screenPos.y) = (weights >= hashParams.m_confidenceThresh) ? wpos.z : 1000.0f;
+			//output(x,y) = (weights >= hashParams.m_confidenceThresh) ? wpos.z : 1000.0f;
+		}
 	}
 }
 
-- 
GitLab