diff --git a/applications/reconstruct/src/reconstruction.cpp b/applications/reconstruct/src/reconstruction.cpp index be1f6cd8be2246f2ae8c2b7048c03fe85ebd3633..8a868e56eeeba0a459a939f086d891652093c7e2 100644 --- a/applications/reconstruct/src/reconstruction.cpp +++ b/applications/reconstruct/src/reconstruction.cpp @@ -61,7 +61,7 @@ Reconstruction::Reconstruction(nlohmann::json &config, const std::string name) : ftl::pool.push([this](int id) { UNIQUE_LOCK(fs_align_.mtx, lk); - rgb_.resize(fs_align_.frames.size()); + /*rgb_.resize(fs_align_.frames.size()); for (size_t i = 0; i < rgb_.size(); i++) { auto &depth = fs_align_.frames[i].get<cv::cuda::GpuMat>(ftl::codecs::Channel::Depth); auto &color = fs_align_.frames[i].get<cv::cuda::GpuMat>(ftl::codecs::Channel::Colour); @@ -70,7 +70,7 @@ Reconstruction::Reconstruction(nlohmann::json &config, const std::string name) : std::swap(rgb_[i], color); cv::cuda::resize(rgb_[i], color, depth.size(), 0.0, 0.0, cv::INTER_LINEAR); } - } + }*/ pipeline_->apply(fs_align_, fs_align_, 0); diff --git a/components/operators/src/colours.cpp b/components/operators/src/colours.cpp index 9c6fff8b887fc645da71fbc99e018a6dc99b6313..6a49f6ede7f4cd7f130a889378ce41880bfff617 100644 --- a/components/operators/src/colours.cpp +++ b/components/operators/src/colours.cpp @@ -14,11 +14,12 @@ ColourChannels::~ColourChannels() { bool ColourChannels::apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, ftl::rgbd::Source *s, cudaStream_t stream) { auto cvstream = cv::cuda::StreamAccessor::wrapStream(stream); + auto &col = in.get<cv::cuda::GpuMat>(Channel::Colour); + // Convert colour from BGR to BGRA if needed - if (in.get<cv::cuda::GpuMat>(Channel::Colour).type() == CV_8UC3) { + if (col.type() == CV_8UC3) { //cv::cuda::Stream cvstream = cv::cuda::StreamAccessor::wrapStream(stream); // Convert to 4 channel colour - auto &col = in.get<cv::cuda::GpuMat>(Channel::Colour); temp_.create(col.size(), CV_8UC4); cv::cuda::swap(col, temp_); cv::cuda::cvtColor(temp_,col, cv::COLOR_BGR2BGRA, 0, cvstream); @@ -27,5 +28,13 @@ bool ColourChannels::apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, ftl::rgb //in.resetTexture(Channel::Colour); in.createTexture<uchar4>(Channel::Colour, true); + auto &depth = in.get<cv::cuda::GpuMat>(Channel::Depth); + if (depth.size() != col.size()) { + auto &col2 = in.create<cv::cuda::GpuMat>(Channel::ColourHighRes); + cv::cuda::resize(col, col2, depth.size(), 0.0, 0.0, cv::INTER_LINEAR, cvstream); + in.createTexture<uchar4>(Channel::ColourHighRes, true); + in.swapChannels(Channel::Colour, Channel::ColourHighRes); + } + return true; } diff --git a/components/renderers/cpp/src/tri_render.cpp b/components/renderers/cpp/src/tri_render.cpp index 06d4fe2626f01e989645e19e795ef4df925c96c2..42693dd3fddfdaa9be7d53688bdfa52f79b12ee2 100644 --- a/components/renderers/cpp/src/tri_render.cpp +++ b/components/renderers/cpp/src/tri_render.cpp @@ -607,7 +607,11 @@ bool Triangular::render(ftl::rgbd::VirtualSource *src, ftl::rgbd::Frame &out, co } // Reprojection of colours onto surface - _renderChannel(out, Channel::Colour, Channel::Colour, t, stream_); + auto main_channel = (scene_->frames[0].hasChannel(Channel::ColourHighRes)) ? Channel::ColourHighRes : Channel::Colour; + //if (scene_->frames[0].hasChannel(Channel::ColourHighRes)) { + // LOG(INFO) << "HAVE HIGH RES: " << scene_->frames[0].get<GpuMat>(Channel::ColourHighRes).rows; + //} + _renderChannel(out, main_channel, Channel::Colour, t, stream_); if (value("cool_effect", false)) { auto pose = params.m_viewMatrixInverse.getFloat3x3();