diff --git a/applications/reconstruct/src/depth_camera.cu b/applications/reconstruct/src/depth_camera.cu index ca8a0b199702e0a4718c421d19c4a807f120710e..8490c38b2422bdd1834244bf5acf974a875b3a1e 100644 --- a/applications/reconstruct/src/depth_camera.cu +++ b/applications/reconstruct/src/depth_camera.cu @@ -254,22 +254,27 @@ __global__ void mls_smooth_kernel(ftl::cuda::TextureObject<float4> output, HashP if (depth >= mainCamera.params.m_sensorDepthWorldMin && depth <= mainCamera.params.m_sensorDepthWorldMax) { float3 mPos = mainCamera.pose * mainCamera.params.kinectDepthToSkeleton(x, y, depth); - if (hashParams.m_flags & ftl::voxhash::kFlagMLS) { - for (uint cam2=0; cam2<numcams; ++cam2) { - if (cam2 == cam) continue; //weights += mlsCamera(cam2, mPos, c1, wpos); - weights += mlsCameraBest(cam2, mPos, c1, wpos); - } - wpos /= weights; - } else { - weights = 1000.0f; - wpos = mPos; - } + if ((!(hashParams.m_flags & ftl::voxhash::kFlagClipping)) || (mPos.x > hashParams.m_minBounds.x && mPos.x < hashParams.m_maxBounds.x && + mPos.y > hashParams.m_minBounds.y && mPos.y < hashParams.m_maxBounds.y && + mPos.z > hashParams.m_minBounds.z && mPos.z < hashParams.m_maxBounds.z)) { + + if (hashParams.m_flags & ftl::voxhash::kFlagMLS) { + for (uint cam2=0; cam2<numcams; ++cam2) { + if (cam2 == cam) continue; //weights += mlsCamera(cam2, mPos, c1, wpos); + weights += mlsCameraBest(cam2, mPos, c1, wpos); + } + wpos /= weights; + } else { + weights = 1000.0f; + wpos = mPos; + } - //output(x,y) = (weights >= hashParams.m_confidenceThresh) ? make_float4(wpos, 0.0f) : make_float4(MINF,MINF,MINF,MINF); + //output(x,y) = (weights >= hashParams.m_confidenceThresh) ? make_float4(wpos, 0.0f) : make_float4(MINF,MINF,MINF,MINF); - const uint2 screenPos = make_uint2(mainCamera.params.cameraToKinectScreenInt(mainCamera.poseInverse * wpos)); - if (screenPos.x < output.width() && screenPos.y < output.height()) { - output(screenPos.x,screenPos.y) = (weights >= hashParams.m_confidenceThresh) ? make_float4(wpos, 0.0f) : make_float4(MINF,MINF,MINF,MINF); + const uint2 screenPos = make_uint2(mainCamera.params.cameraToKinectScreenInt(mainCamera.poseInverse * wpos)); + if (screenPos.x < output.width() && screenPos.y < output.height()) { + output(screenPos.x,screenPos.y) = (weights >= hashParams.m_confidenceThresh) ? make_float4(wpos, 0.0f) : make_float4(MINF,MINF,MINF,MINF); + } } } }