From 1a480a3d8d055aaf0bec2f56b465d601906284e7 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Mon, 12 Aug 2019 09:01:11 +0300
Subject: [PATCH] Working adaptive smoothing

---
 applications/reconstruct/src/dibr.cu | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/applications/reconstruct/src/dibr.cu b/applications/reconstruct/src/dibr.cu
index 93ea413e4..423de0d4e 100644
--- a/applications/reconstruct/src/dibr.cu
+++ b/applications/reconstruct/src/dibr.cu
@@ -550,7 +550,7 @@ __device__ inline float warpMin(float e) {
 	if (maxenergy >= ENERGY_THRESHOLD) return;
 
 	// Move to next possible surface...
-	clusterBase = minDepth + 0.01f;
+	clusterBase = minDepth + SMOOTHING_MULTIPLIER_B*(minDepth / params.camera.fx);
 
 	};
 }
@@ -613,7 +613,7 @@ __global__ void dibr_attribute_contrib_kernel(
 		const float3 nearest = params.camera.kinectDepthToSkeleton((int)(screenPos.x+u),(int)(screenPos.y+v),d);
 
         // What is contribution of our current point at this pixel?
-        const float weight = ftl::cuda::spatialWeighting(length(nearest - camPos), SPATIAL_SMOOTHING);
+        const float weight = ftl::cuda::spatialWeighting(length(nearest - camPos), SMOOTHING_MULTIPLIER_B*(nearest.z/params.camera.fx));
         if (screenPos.x+u < colour_out.width() && screenPos.y+v < colour_out.height() && weight > 0.0f) {  // TODO: Use confidence threshold here
             const float4 wcolour = colour * weight;
 			const float4 wnormal = normal * weight;
-- 
GitLab