diff --git a/applications/reconstruct/src/ilw/ilw.cpp b/applications/reconstruct/src/ilw/ilw.cpp index 778a3d36e9178e90e5a5ba90c029be244c302565..1400592e48273f2dee21d45d87a7225ab6a840ae 100644 --- a/applications/reconstruct/src/ilw/ilw.cpp +++ b/applications/reconstruct/src/ilw/ilw.cpp @@ -22,6 +22,7 @@ ILW::ILW(nlohmann::json &config) : ftl::Configurable(config) { params_.colour_smooth = value("colour_smooth", 50.0f); params_.spatial_smooth = value("spatial_smooth", 0.04f); params_.cost_ratio = value("cost_ratio", 0.75f); + discon_mask_ = value("discontinuity_mask",2); on("ilw_align", [this](const ftl::config::Event &e) { enabled_ = value("ilw_align", true); @@ -39,6 +40,10 @@ ILW::ILW(nlohmann::json &config) : ftl::Configurable(config) { motion_window_ = value("motion_window", 3); }); + on("discontinuity_mask", [this](const ftl::config::Event &e) { + discon_mask_ = value("discontinuity_mask", 2); + }); + on("use_Lab", [this](const ftl::config::Event &e) { use_lab_ = value("use_Lab", false); }); @@ -116,7 +121,7 @@ bool ILW::_phase0(ftl::rgbd::FrameSet &fs, cudaStream_t stream) { auto &t = f.createTexture<float4>(Channel::Points, Format<float4>(f.get<GpuMat>(Channel::Colour).size())); auto pose = MatrixConversion::toCUDA(s->getPose().cast<float>()); //.inverse()); - ftl::cuda::point_cloud(t, f.createTexture<float>(Channel::Depth), s->parameters(), pose, 2, stream); + ftl::cuda::point_cloud(t, f.createTexture<float>(Channel::Depth), s->parameters(), pose, discon_mask_, stream); // TODO: Create energy vector texture and clear it // Create energy and clear it diff --git a/applications/reconstruct/src/ilw/ilw.hpp b/applications/reconstruct/src/ilw/ilw.hpp index 66de927a285716b2a1d9efd1b2fdb8577a1f6149..96a5341544471ed4fbe6f6269f6531177a26b9ef 100644 --- a/applications/reconstruct/src/ilw/ilw.hpp +++ b/applications/reconstruct/src/ilw/ilw.hpp @@ -69,6 +69,7 @@ class ILW : public ftl::Configurable { float motion_rate_; int motion_window_; bool use_lab_; + int discon_mask_; }; } diff --git a/components/renderers/cpp/src/points.cu b/components/renderers/cpp/src/points.cu index b2e83577d4fe1d9e7c3d82ecfb615724904d980f..f73eaa2085e901991f9cc40580a3273864ceda4f 100644 --- a/components/renderers/cpp/src/points.cu +++ b/components/renderers/cpp/src/points.cu @@ -51,6 +51,7 @@ void ftl::cuda::point_cloud(ftl::cuda::TextureObject<float4> &output, ftl::cuda: const dim3 blockSize(T_PER_BLOCK, T_PER_BLOCK); switch (discon) { + case 4 : point_cloud_kernel<4><<<gridSize, blockSize, 0, stream>>>(output, depth, params, pose); break; case 3 : point_cloud_kernel<3><<<gridSize, blockSize, 0, stream>>>(output, depth, params, pose); break; case 2 : point_cloud_kernel<2><<<gridSize, blockSize, 0, stream>>>(output, depth, params, pose); break; case 1 : point_cloud_kernel<1><<<gridSize, blockSize, 0, stream>>>(output, depth, params, pose); break; diff --git a/components/renderers/cpp/src/splat_render.cpp b/components/renderers/cpp/src/splat_render.cpp index 68d60599f9e2b6868faf78abbdfff669210e41cb..24afd49a65c8c964b57643cf593094581bdf23c4 100644 --- a/components/renderers/cpp/src/splat_render.cpp +++ b/components/renderers/cpp/src/splat_render.cpp @@ -85,22 +85,6 @@ void Splatter::renderChannel( continue; } - // Needs to create points channel first? - if (!f.hasChannel(Channel::Points)) { - //LOG(INFO) << "Creating points... " << s->parameters().width; - - auto &t = f.createTexture<float4>(Channel::Points, Format<float4>(f.get<GpuMat>(Channel::Colour).size())); - auto pose = MatrixConversion::toCUDA(s->getPose().cast<float>()); //.inverse()); - ftl::cuda::point_cloud(t, f.createTexture<float>(Channel::Depth), s->parameters(), pose, 0, stream); - - //LOG(INFO) << "POINTS Added"; - } - - // Clip first? - if (clipping_) { - ftl::cuda::clipping(f.createTexture<float4>(Channel::Points), clip_, stream); - } - ftl::cuda::dibr_merge( f.createTexture<float4>(Channel::Points), temp_.getTexture<int>(Channel::Depth), @@ -262,6 +246,22 @@ bool Splatter::render(ftl::rgbd::VirtualSource *src, ftl::rgbd::Frame &out, cuda auto &f = scene_->frames[i]; auto s = scene_->sources[i]; + // Needs to create points channel first? + if (!f.hasChannel(Channel::Points)) { + //LOG(INFO) << "Creating points... " << s->parameters().width; + + auto &t = f.createTexture<float4>(Channel::Points, Format<float4>(f.get<GpuMat>(Channel::Colour).size())); + auto pose = MatrixConversion::toCUDA(s->getPose().cast<float>()); //.inverse()); + ftl::cuda::point_cloud(t, f.createTexture<float>(Channel::Depth), s->parameters(), pose, 0, stream); + + //LOG(INFO) << "POINTS Added"; + } + + // Clip first? + if (clipping_) { + ftl::cuda::clipping(f.createTexture<float4>(Channel::Points), clip_, stream); + } + if (!f.hasChannel(Channel::Normals)) { auto &g = f.get<GpuMat>(Channel::Colour); ftl::cuda::normals(f.createTexture<float4>(Channel::Normals, Format<float4>(g.cols, g.rows)),