From 77cb19e91149af68cdfa632c06b0e52ed91370cd Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Wed, 11 Dec 2019 13:33:58 +0200 Subject: [PATCH] Use depthThreshold in reproject --- components/operators/src/correspondence.cu | 6 +++--- components/operators/src/mvmls.cpp | 4 +++- components/renderers/cpp/src/reprojection.cu | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/components/operators/src/correspondence.cu b/components/operators/src/correspondence.cu index 828f7bcb1..05d601060 100644 --- a/components/operators/src/correspondence.cu +++ b/components/operators/src/correspondence.cu @@ -215,7 +215,7 @@ __global__ void corresponding_point_kernel( uint stepMask = 1 << bestStep; if ((stepMask & badMask) || (stepMask & (badMask << 1)) || (stepMask & (badMask >> 1))) bestweight = 0.0f; - bestadjust = halfWarpBest(bestadjust, (bestweight > 0.0f) ? confidence : 0.0f); + //bestadjust = halfWarpBest(bestadjust, (bestweight > 0.0f) ? confidence : 0.0f); //Mask m(mask.tex2D(x,y)); @@ -226,8 +226,8 @@ __global__ void corresponding_point_kernel( d1(x,y) = (0.4f*bestadjust) + depth1; //d2(bestScreen.x, bestScreen.y) = bestdepth2; //screenOut(x,y) = bestScreen; - //conf(x,y) = max(old,confidence); //bestweight * confidence; - conf(x,y) = max(old,fabs(bestadjust)); + conf(x,y) = max(old,confidence); //bestweight * confidence; + //conf(x,y) = max(old,fabs(bestadjust)); } //} diff --git a/components/operators/src/mvmls.cpp b/components/operators/src/mvmls.cpp index 4a61e6322..8ff3c89dd 100644 --- a/components/operators/src/mvmls.cpp +++ b/components/operators/src/mvmls.cpp @@ -72,6 +72,8 @@ bool MultiViewMLS::apply(ftl::rgbd::FrameSet &in, ftl::rgbd::FrameSet &out, cuda f.createTexture<float>(Channel::Confidence); f.create<GpuMat>(Channel::Screen, Format<short2>(size)); f.createTexture<short2>(Channel::Screen); + + f.get<GpuMat>(Channel::Confidence).setTo(cv::Scalar(0.0f), cvstream); } for (int iter=0; iter<iters; ++iter) { @@ -84,7 +86,7 @@ bool MultiViewMLS::apply(ftl::rgbd::FrameSet &in, ftl::rgbd::FrameSet &out, cuda for (size_t i=0; i<in.frames.size(); ++i) { auto &f1 = in.frames[i]; //f1.get<GpuMat>(Channel::Depth2).setTo(cv::Scalar(0.0f), cvstream); - f1.get<GpuMat>(Channel::Confidence).setTo(cv::Scalar(0.0f), cvstream); + //f1.get<GpuMat>(Channel::Confidence).setTo(cv::Scalar(0.0f), cvstream); Eigen::Vector4d d1(0.0, 0.0, 1.0, 0.0); d1 = in.sources[i]->getPose() * d1; diff --git a/components/renderers/cpp/src/reprojection.cu b/components/renderers/cpp/src/reprojection.cu index b23ad81e9..a4b27d475 100644 --- a/components/renderers/cpp/src/reprojection.cu +++ b/components/renderers/cpp/src/reprojection.cu @@ -97,7 +97,7 @@ __global__ void reprojection_kernel( const auto input = in.tex2D(screenPos.x, screenPos.y); //generateInput(in.tex2D((int)screenPos.x, (int)screenPos.y), params, worldPos); // TODO: Z checks need to interpolate between neighbors if large triangles are used - float weight = ftl::cuda::weighting(fabs(camPos.z - d2), 0.02f); + float weight = ftl::cuda::weighting(fabs(camPos.z - d2), params.depthThreshold); /* Buehler C. et al. 2001. Unstructured Lumigraph Rendering. */ /* Orts-Escolano S. et al. 2016. Holoportation: Virtual 3D teleportation in real-time. */ -- GitLab