diff --git a/applications/reconstruct/src/ilw/ilw.cpp b/applications/reconstruct/src/ilw/ilw.cpp index 445db06b9ff06a3fc15e8b3624295f1bb983b8e5..43a27782e1fe33f410aa55a9e2536a9cece26874 100644 --- a/applications/reconstruct/src/ilw/ilw.cpp +++ b/applications/reconstruct/src/ilw/ilw.cpp @@ -106,7 +106,7 @@ bool ILW::process(ftl::rgbd::FrameSet &fs, cudaStream_t stream) { _phase0(fs, stream); - params_.range = 0.1f; + params_.range = 0.05f; for (int i=0; i<iterations_; ++i) { _phase1(fs, value("cost_function",3), stream); @@ -114,7 +114,7 @@ bool ILW::process(ftl::rgbd::FrameSet &fs, cudaStream_t stream) { _phase2(fs, motion_rate_, stream); //} - params_.range *= 0.5f; + params_.range *= 0.9f; // TODO: Break if no time left } diff --git a/applications/reconstruct/src/ilw/ilw.cu b/applications/reconstruct/src/ilw/ilw.cu index c6a63cfa7502bcaa4da97317dfc47a628b675afd..831ff641b50dd7396a7282b99119a72164f6a34e 100644 --- a/applications/reconstruct/src/ilw/ilw.cu +++ b/applications/reconstruct/src/ilw/ilw.cu @@ -108,6 +108,11 @@ __device__ inline float weightFunction<3>(const ftl::cuda::ILWParams ¶ms, fl return (dweight == 0.0f) ? 0.0f : (params.cost_ratio * (cweight) + (1.0f - params.cost_ratio) * dweight); } +template <> +__device__ inline float weightFunction<4>(const ftl::cuda::ILWParams ¶ms, float dweight, float cweight) { + return cweight; +} + template<int COR_STEPS, int FUNCTION> __global__ void correspondence_energy_vector_kernel( TextureObject<float> d1, @@ -169,6 +174,7 @@ __global__ void correspondence_energy_vector_kernel( // Generate a depth correspondence value const float depth2 = d2.tex2D((int)screen.x, (int)screen.y); const float dweight = ftl::cuda::weighting(fabs(depth2 - camPos.z), params.spatial_smooth); + //const float dweight = ftl::cuda::weighting(fabs(depth_adjust - depth1), 2.0f*params.range); // Generate a colour correspondence value const uchar4 colour2 = c2.tex2D((int)screen.x, (int)screen.y); @@ -223,6 +229,7 @@ void ftl::cuda::correspondence( case 1: correspondence_energy_vector_kernel<16,1><<<gridSize, blockSize, 0, stream>>>(d1, d2, c1, c2, dout, conf, pose1, pose1_inv, pose2, cam1, cam2, params); break; case 2: correspondence_energy_vector_kernel<16,2><<<gridSize, blockSize, 0, stream>>>(d1, d2, c1, c2, dout, conf, pose1, pose1_inv, pose2, cam1, cam2, params); break; case 3: correspondence_energy_vector_kernel<16,3><<<gridSize, blockSize, 0, stream>>>(d1, d2, c1, c2, dout, conf, pose1, pose1_inv, pose2, cam1, cam2, params); break; + case 4: correspondence_energy_vector_kernel<16,4><<<gridSize, blockSize, 0, stream>>>(d1, d2, c1, c2, dout, conf, pose1, pose1_inv, pose2, cam1, cam2, params); break; } cudaSafeCall( cudaGetLastError() ); @@ -266,7 +273,7 @@ __global__ void move_points_kernel( //if (pn.x == MINF) continue; if (dn_new == 0.0f) continue; // Neighbour has no new correspondence - const float s = ftl::cuda::weighting(fabs(d0_new - dn_new), params.range); + const float s = ftl::cuda::spatialWeighting(camera.screenToCam(x,y,d0_new), camera.screenToCam(x+u,y+v,dn_new), params.range); // ftl::cuda::weighting(fabs(d0_new - dn_new), params.range); contrib += (confn+0.01f) * s; delta += (confn+0.01f) * s * ((confn == 0.0f) ? dn_old : dn_new); }