From 850431fd2380b5f1be27fdb0d08eb52d6cab860e Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Sat, 5 Oct 2019 16:15:05 +0300
Subject: [PATCH] range adjustment

---
 applications/reconstruct/src/ilw/ilw.cpp      | 3 +++
 applications/reconstruct/src/ilw/ilw.cu       | 2 +-
 applications/reconstruct/src/ilw/ilw_cuda.hpp | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/applications/reconstruct/src/ilw/ilw.cpp b/applications/reconstruct/src/ilw/ilw.cpp
index 53fef0890..3feb23dff 100644
--- a/applications/reconstruct/src/ilw/ilw.cpp
+++ b/applications/reconstruct/src/ilw/ilw.cpp
@@ -96,6 +96,8 @@ bool ILW::process(ftl::rgbd::FrameSet &fs, cudaStream_t stream) {
 
     _phase0(fs, stream);
 
+	params_.range = 0.05f;
+
     for (int i=0; i<iterations_; ++i) {
         int win;
         switch (i) {
@@ -108,6 +110,7 @@ bool ILW::process(ftl::rgbd::FrameSet &fs, cudaStream_t stream) {
             _phase2(fs, motion_rate_, stream);
         //}
 
+		params_.range *= 0.5f;
 		// TODO: Break if no time left
     }
 
diff --git a/applications/reconstruct/src/ilw/ilw.cu b/applications/reconstruct/src/ilw/ilw.cu
index 43236e4d8..2c8d3199b 100644
--- a/applications/reconstruct/src/ilw/ilw.cu
+++ b/applications/reconstruct/src/ilw/ilw.cu
@@ -61,7 +61,7 @@ __global__ void correspondence_energy_vector_kernel(
     float bestdepth;
     int count = 0;
     
-	const float step_interval = 0.05f / (COR_STEPS / 2);
+	const float step_interval = params.range / (COR_STEPS / 2);
 	
 	const float3 rayStep_world = pose1.getFloat3x3() * cam1.screenToCam(x,y,step_interval);
 	const float3 rayStart_2 = pose2 * world1;
diff --git a/applications/reconstruct/src/ilw/ilw_cuda.hpp b/applications/reconstruct/src/ilw/ilw_cuda.hpp
index 376790039..503d1bf4c 100644
--- a/applications/reconstruct/src/ilw/ilw_cuda.hpp
+++ b/applications/reconstruct/src/ilw/ilw_cuda.hpp
@@ -13,6 +13,7 @@ struct ILWParams {
     float colour_smooth;
     float cost_ratio;
     float threshold;
+	float range;
     uint flags;
 };
 
-- 
GitLab