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

Add recon pipeline creator

parent ceb21270
No related branches found
No related tags found
1 merge request!316Resolves #343 GUI and Frame Refactor
......@@ -5,6 +5,19 @@
#include <nlohmann/json.hpp>
#include <loguru.hpp>
#include "ftl/operators/smoothing.hpp"
#include "ftl/operators/colours.hpp"
#include "ftl/operators/normals.hpp"
#include "ftl/operators/filling.hpp"
#include "ftl/operators/segmentation.hpp"
#include "ftl/operators/mask.hpp"
#include "ftl/operators/antialiasing.hpp"
#include "ftl/operators/mvmls.hpp"
#include "ftl/operators/clipping.hpp"
#include <ftl/operators/disparity.hpp>
#include <ftl/operators/poser.hpp>
#include <ftl/operators/detectandtrack.hpp>
using ftl::net::Universe;
using ftl::stream::Feed;
using ftl::codecs::Channel;
......@@ -73,6 +86,28 @@ static void run(ftl::Configurable *root) {
auto *filter = feed->filter({Channel::Colour, Channel::Depth});
feed->set("uri", root->value("uri", std::string("ftl://ftlab.utu.fi/reconstruction")));
feed->setPipelineCreator([](ftl::operators::Graph *pipeline) {
pipeline->append<ftl::operators::DepthChannel>("depth"); // Ensure there is a depth channel
pipeline->append<ftl::operators::DisparityBilateralFilter>("bilateral_filter")->value("enabled", false);
pipeline->append<ftl::operators::DisparityToDepth>("calculate_depth")->value("enabled", false);
pipeline->append<ftl::operators::ColourChannels>("colour"); // Convert BGR to BGRA
pipeline->append<ftl::operators::ClipScene>("clipping")->value("enabled", false);
pipeline->append<ftl::operators::DetectAndTrack>("facedetection")->value("enabled", false);
pipeline->append<ftl::operators::ArUco>("aruco")->value("enabled", false);
//pipeline_->append<ftl::operators::HFSmoother>("hfnoise"); // Remove high-frequency noise
pipeline->append<ftl::operators::Normals>("normals"); // Estimate surface normals
//pipeline_->append<ftl::operators::SmoothChannel>("smoothing"); // Generate a smoothing channel
//pipeline_->append<ftl::operators::ScanFieldFill>("filling"); // Generate a smoothing channel
pipeline->append<ftl::operators::CrossSupport>("cross");
pipeline->append<ftl::operators::DiscontinuityMask>("discontinuity");
pipeline->append<ftl::operators::CrossSupport>("cross2")->value("discon_support", true);
pipeline->append<ftl::operators::BorderMask>("border_mask")->value("enabled", false);
pipeline->append<ftl::operators::CullDiscontinuity>("remove_discontinuity")->set("enabled", false);
//pipeline_->append<ftl::operators::AggreMLS>("mls"); // Perform MLS (using smoothing channel)
pipeline->append<ftl::operators::VisCrossSupport>("viscross")->value("enabled", false);
pipeline->append<ftl::operators::MultiViewMLS>("mvmls");
pipeline->append<ftl::operators::Poser>("poser")->value("enabled", false);
});
//feed->lowLatencyMode();
feed->startStreaming(filter);
......
......@@ -135,6 +135,8 @@ public:
cv::Mat getThumbnail(const std::string &uri);
std::string getName(const std::string &uri);
void setPipelineCreator(const std::function<void(ftl::operators::Graph*)> &cb);
ftl::operators::Graph* addPipeline(const std::string &name);
ftl::operators::Graph* addPipeline(uint32_t fsid);
/** Returns pointer to filter object. Pointers will be invalid after Feed
......@@ -189,6 +191,7 @@ private:
std::unordered_map<uint32_t, ftl::render::Source*> renderers_;
std::unordered_map<uint32_t, ftl::operators::Graph*> pre_pipelines_;
std::list<ftl::streams::ManualSourceBuilder*> render_builders_;
std::function<void(ftl::operators::Graph*)> pipe_creator_;
std::vector<std::string> netcams_;
ftl::Handler<const std::vector<std::string> &> new_sources_cb_;
......
......@@ -444,22 +444,31 @@ void Feed::_createPipeline(uint32_t fsid) {
LOG(INFO) << "Creating pipeline";
auto *p = _addPipeline(fsid);
p->append<ftl::operators::DepthChannel>("depth")->value("enabled", false);
p->append<ftl::operators::ClipScene>("clipping")->value("enabled", false);
p->append<ftl::operators::ColourChannels>("colour"); // Convert BGR to BGRA
p->append<ftl::operators::DetectAndTrack>("facedetection")->value("enabled", false);
p->append<ftl::operators::ArUco>("aruco")->value("enabled", false);
//p->append<ftl::operators::HFSmoother>("hfnoise");
p->append<ftl::operators::CrossSupport>("cross");
p->append<ftl::operators::PixelWeights>("weights");
p->append<ftl::operators::CullWeight>("remove_weights")->value("enabled", false);
p->append<ftl::operators::DegradeWeight>("degrade");
p->append<ftl::operators::VisCrossSupport>("viscross")->set("enabled", false);
p->append<ftl::operators::BorderMask>("border_mask");
p->append<ftl::operators::CullDiscontinuity>("remove_discontinuity");
p->append<ftl::operators::MultiViewMLS>("mvmls")->value("enabled", false);
p->append<ftl::operators::Poser>("poser")->value("enabled", true);
p->append<ftl::operators::GTAnalysis>("gtanalyse");
if (pipe_creator_) {
pipe_creator_(p);
} else {
p->append<ftl::operators::DepthChannel>("depth")->value("enabled", false);
p->append<ftl::operators::ClipScene>("clipping")->value("enabled", false);
p->append<ftl::operators::ColourChannels>("colour"); // Convert BGR to BGRA
p->append<ftl::operators::DetectAndTrack>("facedetection")->value("enabled", false);
p->append<ftl::operators::ArUco>("aruco")->value("enabled", false);
//p->append<ftl::operators::HFSmoother>("hfnoise");
p->append<ftl::operators::CrossSupport>("cross");
p->append<ftl::operators::PixelWeights>("weights");
p->append<ftl::operators::CullWeight>("remove_weights")->value("enabled", false);
p->append<ftl::operators::DegradeWeight>("degrade");
p->append<ftl::operators::VisCrossSupport>("viscross")->set("enabled", false);
p->append<ftl::operators::BorderMask>("border_mask");
p->append<ftl::operators::CullDiscontinuity>("remove_discontinuity");
p->append<ftl::operators::MultiViewMLS>("mvmls")->value("enabled", false);
p->append<ftl::operators::Poser>("poser")->value("enabled", true);
p->append<ftl::operators::GTAnalysis>("gtanalyse");
}
}
void Feed::setPipelineCreator(const std::function<void(ftl::operators::Graph*)> &cb) {
UNIQUE_LOCK(mtx_, lk);
pipe_creator_ = cb;
}
void Feed::removeFilter(Feed::Filter* filter) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment