From a40e5cdb297b811e4ea1de16b405f27cad64ec02 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Mon, 10 Feb 2020 09:29:15 +0200 Subject: [PATCH] Fix show mask image size bug --- components/renderers/cpp/src/CUDARender.cpp | 1 + components/renderers/cpp/src/mask.cu | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/components/renderers/cpp/src/CUDARender.cpp b/components/renderers/cpp/src/CUDARender.cpp index d407db476..7393fec64 100644 --- a/components/renderers/cpp/src/CUDARender.cpp +++ b/components/renderers/cpp/src/CUDARender.cpp @@ -642,6 +642,7 @@ void CUDARender::_renderPass2(Channels<0> chans, const Eigen::Matrix4d &t) { // Reprojection of colours onto surface auto main_channel = (scene_->frames[0].hasChannel(Channel::ColourHighRes)) ? Channel::ColourHighRes : Channel::Colour; + LOG(INFO) << "USING COLOR: " << (int)main_channel; _renderChannel(*out_, main_channel, Channel::Colour, t, stream_); diff --git a/components/renderers/cpp/src/mask.cu b/components/renderers/cpp/src/mask.cu index e46c2a131..e23012c7b 100644 --- a/components/renderers/cpp/src/mask.cu +++ b/components/renderers/cpp/src/mask.cu @@ -15,7 +15,10 @@ __global__ void show_mask_kernel( const int y = blockIdx.y*blockDim.y + threadIdx.y; if (x >= 0 && x < colour.width() && y >=0 && y < colour.height()) { - Mask m(mask.tex2D(x,y)); + float xscale = (float)x * ((float)mask.width() / (float)colour.width()); + float yscale = (float)y * ((float)mask.height() / (float)colour.height()); + + Mask m(mask.tex2D((int)xscale,(int)yscale)); if (m.is(id)) { colour(x,y) = style; -- GitLab