diff --git a/applications/reconstruct/src/main.cpp b/applications/reconstruct/src/main.cpp index 68c1cb03b8b8560db257546b22db8770befc4dd0..948d9a5745c6a39ee1018a7966aecdb8caa08773 100644 --- a/applications/reconstruct/src/main.cpp +++ b/applications/reconstruct/src/main.cpp @@ -248,14 +248,18 @@ static void run(ftl::Configurable *root) { bool busy = false; // Create the source depth map filters - auto *filters = ftl::config::create<ftl::Filters>(root, "filters"); - filters->create<ftl::filters::ColourChannels>("colour"); - filters->create<ftl::filters::DepthSmoother>("hfnoise"); - filters->create<ftl::filters::MLSSmoother>("mls"); + auto *prefilter = ftl::config::create<ftl::Filters>(root, "pre_filters"); + prefilter->create<ftl::filters::ColourChannels>("colour"); + prefilter->create<ftl::filters::DepthSmoother>("hfnoise"); + prefilter->create<ftl::filters::MLSSmoother>("mls"); + + 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,filters](ftl::rgbd::FrameSet &fs) -> bool { + group->sync([splat,virt,&busy,&slave,&scene_A,&scene_B,&align,controls,prefilter,postfilter](ftl::rgbd::FrameSet &fs) -> bool { //cudaSetDevice(scene->getCUDADevice()); //if (slave.isPaused()) return true; @@ -270,7 +274,7 @@ 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, filters](int id) { + ftl::pool.push([&scene_B,&scene_A,&busy,&slave,&align, prefilter, postfilter](int id) { //cudaSetDevice(scene->getCUDADevice()); // TODO: Release frameset here... //cudaSafeCall(cudaStreamSynchronize(scene->getIntegrationStream())); @@ -281,13 +285,20 @@ static void run(ftl::Configurable *root) { for (int i=0; i<scene_A.frames.size(); ++i) { auto &f = scene_A.frames[i]; auto s = scene_A.sources[i]; - filters->filter(f, s, 0); + prefilter->filter(f, s, 0); } // Send all frames to GPU, block until done? //scene_A.upload(Channel::Colour + Channel::Depth); // TODO: (Nick) Add scene stream. 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. scene_A.swapTo(scene_B);