Skip to content
Snippets Groups Projects

Implements #228 adaptive MLS and smoothing channel

Merged Nicolas Pope requested to merge feature/mlssmooth into master
3 files
+ 44
27
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -250,20 +250,18 @@ static void run(ftl::Configurable *root) {
bool busy = false;
// Create the source depth map pipeline
auto *prefilter = ftl::config::create<ftl::operators::Graph>(root, "pre_filters");
prefilter->append<ftl::operators::ColourChannels>("colour");
prefilter->append<ftl::operators::HFSmoother>("hfnoise");
prefilter->append<ftl::operators::Normals>("normals");
prefilter->append<ftl::operators::SimpleMLS>("mls");
auto *pipeline1 = ftl::config::create<ftl::operators::Graph>(root, "pre_filters");
pipeline1->append<ftl::operators::ColourChannels>("colour"); // Convert BGR to BGRA
pipeline1->append<ftl::operators::HFSmoother>("hfnoise"); // Remove high-frequency noise
pipeline1->append<ftl::operators::Normals>("normals"); // Estimate surface normals
pipeline1->append<ftl::operators::SmoothChannel>("smoothing"); // Generate a smoothing channel
pipeline1->append<ftl::operators::SimpleMLS>("mls"); // Perform MLS (using smoothing channel)
// Alignment
//auto *postfilter = ftl::config::create<ftl::Filters>(root, "post_filters");
//postfilter->create<ftl::filters::DepthSmoother>("hfnoise");
//postfilter->create<ftl::filters::MLSSmoother>("mls");
group->setLatency(4);
group->setName("ReconGroup");
group->sync([splat,virt,&busy,&slave,&scene_A,&scene_B,&align,controls,prefilter](ftl::rgbd::FrameSet &fs) -> bool {
group->sync([splat,virt,&busy,&slave,&scene_A,&scene_B,&align,controls,pipeline1](ftl::rgbd::FrameSet &fs) -> bool {
//cudaSetDevice(scene->getCUDADevice());
//if (slave.isPaused()) return true;
@@ -278,32 +276,16 @@ static void run(ftl::Configurable *root) {
// Swap the entire frameset to allow rapid return
fs.swapTo(scene_A);
ftl::pool.push([&scene_B,&scene_A,&busy,&slave,&align, prefilter](int id) {
ftl::pool.push([&scene_B,&scene_A,&busy,&slave,&align, pipeline1](int id) {
//cudaSetDevice(scene->getCUDADevice());
// TODO: Release frameset here...
//cudaSafeCall(cudaStreamSynchronize(scene->getIntegrationStream()));
UNIQUE_LOCK(scene_A.mtx, lk);
// Apply pre-filters to all frames
/*for (int i=0; i<scene_A.frames.size(); ++i) {
auto &f = scene_A.frames[i];
auto s = scene_A.sources[i];
prefilter->apply(f, f, s, 0);
}*/
prefilter->apply(scene_A, scene_A, 0);
// Send all frames to GPU, block until done?
//scene_A.upload(Channel::Colour + Channel::Depth); // TODO: (Nick) Add scene stream.
pipeline1->apply(scene_A, scene_A, 0);
align->process(scene_A);
// Apply post-filters to all frames
/*for (int i=0; i<scene_A.frames.size(); ++i) {
auto &f = scene_A.frames[i];
auto s = scene_A.sources[i];
postfilter->filter(f, s, 0);
}*/
// TODO: To use second GPU, could do a download, swap, device change,
// then upload to other device. Or some direct device-2-device copy.
Loading