From dff369754e1f3f01164a8dab2fc64e107250ecb1 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Wed, 30 Oct 2019 11:20:14 +0200 Subject: [PATCH] Add check for empty channel2 --- applications/reconstruct/src/ilw/ilw.cpp | 2 +- components/renderers/cpp/src/tri_render.cpp | 2 +- components/rgbd-sources/include/ftl/rgbd/frame.hpp | 2 +- components/rgbd-sources/src/source.cpp | 2 +- components/rgbd-sources/src/sources/virtual/virtual.cpp | 3 +-- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/applications/reconstruct/src/ilw/ilw.cpp b/applications/reconstruct/src/ilw/ilw.cpp index 93fd75a18..dfa43267e 100644 --- a/applications/reconstruct/src/ilw/ilw.cpp +++ b/applications/reconstruct/src/ilw/ilw.cpp @@ -144,7 +144,7 @@ ILW::~ILW() { bool ILW::process(ftl::rgbd::FrameSet &fs) { if (!enabled_) return false; - fs.upload(Channel::Colour + Channel::Depth, stream_); + //fs.upload(Channel::Colour + Channel::Depth, stream_); _phase0(fs, stream_); params_.range = value("search_range", 0.05f); diff --git a/components/renderers/cpp/src/tri_render.cpp b/components/renderers/cpp/src/tri_render.cpp index a14aa6b16..cfd81347c 100644 --- a/components/renderers/cpp/src/tri_render.cpp +++ b/components/renderers/cpp/src/tri_render.cpp @@ -357,7 +357,7 @@ bool Triangular::render(ftl::rgbd::VirtualSource *src, ftl::rgbd::Frame &out) { SHARED_LOCK(scene_->mtx, lk); if (!src->isReady()) return false; - scene_->upload(Channel::Colour + Channel::Depth, stream_); + //scene_->upload(Channel::Colour + Channel::Depth, stream_); const auto &camera = src->parameters(); //cudaSafeCall(cudaSetDevice(scene_->getCUDADevice())); diff --git a/components/rgbd-sources/include/ftl/rgbd/frame.hpp b/components/rgbd-sources/include/ftl/rgbd/frame.hpp index b08673c97..52bbe9022 100644 --- a/components/rgbd-sources/include/ftl/rgbd/frame.hpp +++ b/components/rgbd-sources/include/ftl/rgbd/frame.hpp @@ -256,7 +256,7 @@ ftl::cuda::TextureObject<T> &Frame::createTexture(ftl::codecs::Channel c) { //LOG(INFO) << "Creating texture object"; m.tex = ftl::cuda::TextureObject<T>(m.gpu); } else if (m.tex.cvType() != ftl::traits::OpenCVType<T>::value || m.tex.width() != m.gpu.cols || m.tex.height() != m.gpu.rows || m.tex.devicePtr() != m.gpu.data) { - LOG(INFO) << "Recreating texture object for '" << ftl::codecs::name(c) << "'"; + LOG(INFO) << "Recreating texture object for '" << ftl::codecs::name(c) << "'."; m.tex.free(); m.tex = ftl::cuda::TextureObject<T>(m.gpu); } diff --git a/components/rgbd-sources/src/source.cpp b/components/rgbd-sources/src/source.cpp index 089ec6568..6bfecc74c 100644 --- a/components/rgbd-sources/src/source.cpp +++ b/components/rgbd-sources/src/source.cpp @@ -313,7 +313,7 @@ void Source::notify(int64_t ts, cv::cuda::GpuMat &c1, cv::cuda::GpuMat &c2) { } // Should channel 2 be scaled? - if (c2.cols < max_width || c2.rows < max_height) { + if (!c2.empty() && (c2.cols < max_width || c2.rows < max_height)) { if (c2.type() == CV_32F) { cv::cuda::resize(c2, c2, cv::Size(max_width, max_height), 0.0, 0.0, cv::INTER_NEAREST); } else { diff --git a/components/rgbd-sources/src/sources/virtual/virtual.cpp b/components/rgbd-sources/src/sources/virtual/virtual.cpp index fbead5415..a1d1040c6 100644 --- a/components/rgbd-sources/src/sources/virtual/virtual.cpp +++ b/components/rgbd-sources/src/sources/virtual/virtual.cpp @@ -103,8 +103,7 @@ class VirtualImpl : public ftl::rgbd::detail::Source { cv::cuda::swap(frame.get<cv::cuda::GpuMat>(host_->getChannel()), depth_); } - auto cb = host_->callback(); - if (cb) cb(timestamp_, rgb_, depth_); + host_->notify(timestamp_, rgb_, depth_); } return true; } -- GitLab