Skip to content
Snippets Groups Projects
Commit a854f96f authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Add highres channel

parent d7178b81
No related branches found
No related tags found
1 merge request!196High resolution colour
......@@ -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);
......
......@@ -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;
}
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment