From 597a7d51526a58c3a1dd1675272efffae2d9a0cb Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Thu, 20 Feb 2020 12:05:17 +0200 Subject: [PATCH] Redo normals are depth movement --- .../operators/src/fusion/correspondence_common.hpp | 4 ++-- components/operators/src/fusion/mvmls.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/components/operators/src/fusion/correspondence_common.hpp b/components/operators/src/fusion/correspondence_common.hpp index 1bb546994..9f19ef711 100644 --- a/components/operators/src/fusion/correspondence_common.hpp +++ b/components/operators/src/fusion/correspondence_common.hpp @@ -14,8 +14,8 @@ __device__ inline bool isBadCor(float depth, const float2 &pos, const ftl::rgbd: depth >= cam.maxDepth || pos.x < 0.5f || pos.y < 0.5f || - pos.x >= cam.width-0.5f || - pos.y >= cam.height-0.5f; + pos.x >= float(cam.width)-0.5f || + pos.y >= float(cam.height)-0.5f; } __device__ inline float square(float v) { return v*v; } diff --git a/components/operators/src/fusion/mvmls.cpp b/components/operators/src/fusion/mvmls.cpp index 3bb77a52f..55b992957 100644 --- a/components/operators/src/fusion/mvmls.cpp +++ b/components/operators/src/fusion/mvmls.cpp @@ -2,6 +2,7 @@ #include "smoothing_cuda.hpp" #include <ftl/utility/matrix_conversion.hpp> #include "mvmls_cuda.hpp" +#include <ftl/cuda/normals.hpp> #include <opencv2/cudaarithm.hpp> @@ -335,6 +336,16 @@ bool MultiViewMLS::apply(ftl::rgbd::FrameSet &in, ftl::rgbd::FrameSet &out, cuda // Reduce window size for next iteration //win = max(win>>1, 4); + + // Redo normals + for (size_t i=0; i<in.frames.size(); ++i) { + auto &f = in.frames[i]; + ftl::cuda::normals( + f.getTexture<half4>(Channel::Normals), + f.getTexture<float>(Channel::Depth), + f.getLeftCamera(), stream + ); + } } for (int iter=0; iter<iters; ++iter) { -- GitLab