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

Working MLS with poor normals

parent a8b6f653
No related branches found
No related tags found
1 merge request!158Implements #228 adaptive MLS and smoothing channel
This commit is part of merge request !158. Comments created here will be created in the context of that merge request.
......@@ -246,7 +246,7 @@ static void run(ftl::Configurable *root) {
bool busy = false;
auto *smooth = ftl::config::create<ftl::filters::DepthSmoother>(root, "filters");
auto *smooth = ftl::config::create<ftl::filters::MLSSmoother>(root, "filters");
group->setLatency(4);
group->setName("ReconGroup");
......
#include <ftl/filters/smoothing.hpp>
#include "smoothing_cuda.hpp"
#include <ftl/cuda/normals.hpp>
using ftl::filters::DepthSmoother;
using ftl::filters::MLSSmoother;
using ftl::codecs::Channel;
......@@ -66,9 +68,15 @@ MLSSmoother::~MLSSmoother() {
}
void MLSSmoother::smooth(ftl::rgbd::Frame &f, ftl::rgbd::Source *s) {
bool do_smooth = value("mls_smooth", false);
if (!do_smooth) return;
if (!f.hasChannel(Channel::Normals)) {
LOG(ERROR) << "Missing normals for MLS smooth";
return;
ftl::cuda::normals(
f.createTexture<float4>(Channel::Normals, ftl::rgbd::Format<float4>(f.get<cv::cuda::GpuMat>(Channel::Depth).size())),
f.createTexture<float>(Channel::Depth),
s->parameters(), 0
);
}
float thresh = value("mls_threshold", 0.04f);
......@@ -81,6 +89,6 @@ void MLSSmoother::smooth(ftl::rgbd::Frame &f, ftl::rgbd::Source *s) {
0
);
f.swapChannels(Channel::Depth, Channel::Depth2);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment