From 7bfd62f9788bdd6fd8a3bb18512123ac28637c0b Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Thu, 19 Sep 2019 09:32:37 +0300 Subject: [PATCH] Fix colour clear and timestamp --- applications/reconstruct/src/main.cpp | 3 ++- components/renderers/cpp/src/splat_render.cpp | 2 ++ components/rgbd-sources/include/ftl/rgbd/virtual.hpp | 2 ++ components/rgbd-sources/src/streamer.cpp | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/applications/reconstruct/src/main.cpp b/applications/reconstruct/src/main.cpp index 72cdfe570..f7cdf4d37 100644 --- a/applications/reconstruct/src/main.cpp +++ b/applications/reconstruct/src/main.cpp @@ -104,7 +104,8 @@ static void run(ftl::Configurable *root) { ftl::ILW *align = ftl::create<ftl::ILW>(root, "merge"); // Generate virtual camera render when requested by streamer - virt->onRender([splat,virt](ftl::rgbd::Frame &out) { + virt->onRender([splat,virt,&scene_B](ftl::rgbd::Frame &out) { + virt->setTimestamp(scene_B.timestamp); splat->render(virt, out); }); stream->add(virt); diff --git a/components/renderers/cpp/src/splat_render.cpp b/components/renderers/cpp/src/splat_render.cpp index 25dc21c01..55ddbe490 100644 --- a/components/renderers/cpp/src/splat_render.cpp +++ b/components/renderers/cpp/src/splat_render.cpp @@ -76,6 +76,8 @@ bool Splatter::render(ftl::rgbd::VirtualSource *src, ftl::rgbd::Frame &out, cuda // Clear all channels to 0 or max depth temp_.get<GpuMat>(Channel::Depth).setTo(cv::Scalar(0x7FFFFFFF), cvstream); temp_.get<GpuMat>(Channel::Depth2).setTo(cv::Scalar(0x7FFFFFFF), cvstream); + temp_.get<GpuMat>(Channel::Colour).setTo(cv::Scalar(0.0f,0.0f,0.0f,0.0f), cvstream); + temp_.get<GpuMat>(Channel::Contribution).setTo(cv::Scalar(0.0f), cvstream); out.get<GpuMat>(Channel::Depth).setTo(cv::Scalar(1000.0f), cvstream); out.get<GpuMat>(Channel::Colour).setTo(cv::Scalar(76,76,76), cvstream); diff --git a/components/rgbd-sources/include/ftl/rgbd/virtual.hpp b/components/rgbd-sources/include/ftl/rgbd/virtual.hpp index f0ab3a93b..ed3530258 100644 --- a/components/rgbd-sources/include/ftl/rgbd/virtual.hpp +++ b/components/rgbd-sources/include/ftl/rgbd/virtual.hpp @@ -13,6 +13,8 @@ class VirtualSource : public ftl::rgbd::Source { void onRender(const std::function<void(ftl::rgbd::Frame &)> &); + void setTimestamp(int64_t ts) { timestamp_ = ts; } + /** * Write frames into source buffers from an external renderer. Virtual * sources do not have an internal generator of frames but instead have diff --git a/components/rgbd-sources/src/streamer.cpp b/components/rgbd-sources/src/streamer.cpp index 2b43f97a7..3691c36fd 100644 --- a/components/rgbd-sources/src/streamer.cpp +++ b/components/rgbd-sources/src/streamer.cpp @@ -47,7 +47,7 @@ Streamer::Streamer(nlohmann::json &config, Universe *net) hq_devices_ = (value("disable_hardware_encode", false)) ? device_t::Software : device_t::Any; //group_.setFPS(value("fps", 20)); - group_.setLatency(10); + group_.setLatency(3); compress_level_ = value("compression", 1); -- GitLab