Skip to content
Snippets Groups Projects
Commit f44a0d4c authored by Sebastian Hahta's avatar Sebastian Hahta
Browse files

Merge branch 'master' of gitlab.utu.fi:nicolas.pope/ftl

parents a9c6242f ec4cdd3f
No related branches found
No related tags found
No related merge requests found
Pipeline #16488 passed
...@@ -75,8 +75,10 @@ static Eigen::Affine3d create_rotation_matrix(float ax, float ay, float az) { ...@@ -75,8 +75,10 @@ static Eigen::Affine3d create_rotation_matrix(float ax, float ay, float az) {
return rz * rx * ry; return rz * rx * ry;
} }
// TODO: Remove this class (requires more general solution). Also does not // TODO: * Remove this class (requires more general solution). Also does not
// process disconnections/reconnections/types etc. correctly. // process disconnections/reconnections/types etc. correctly.
// * Update when new options become available.
class ConfigProxy { class ConfigProxy {
private: private:
vector<ftl::UUID> peers_; vector<ftl::UUID> peers_;
...@@ -99,20 +101,25 @@ class ConfigProxy { ...@@ -99,20 +101,25 @@ class ConfigProxy {
auto config = json_t::parse(net_->call<string>(peers_[0], "get_cfg", uris_[0] + "/" + uri)); auto config = json_t::parse(net_->call<string>(peers_[0], "get_cfg", uris_[0] + "/" + uri));
auto *proxy = ftl::create<ftl::Configurable>(root, name); auto *proxy = ftl::create<ftl::Configurable>(root, name);
for (auto &itm : config.get<json::object_t>()) { try {
auto key = itm.first; for (auto &itm : config.get<json::object_t>()) {
auto value = itm.second; auto key = itm.first;
if (*key.begin() == '$') { continue; } auto value = itm.second;
if (*key.begin() == '$') { continue; }
proxy->set(key, value);
proxy->on(key, [this, uri, key, value, proxy](const ftl::config::Event&) { proxy->set(key, value);
for (size_t i = 0; i < uris_.size(); i++) { proxy->on(key, [this, uri, key, value, proxy](const ftl::config::Event&) {
// TODO: check that config exists? for (size_t i = 0; i < uris_.size(); i++) {
auto peer = peers_[i]; // TODO: check that config exists?
std::string name = uris_[i] + "/" + uri + "/" + key; auto peer = peers_[i];
net_->send(peer, "update_cfg", name, proxy->getConfig()[key].dump()); std::string name = uris_[i] + "/" + uri + "/" + key;
} net_->send(peer, "update_cfg", name, proxy->getConfig()[key].dump());
}); }
});
}
}
catch (nlohmann::detail::type_error) {
LOG(ERROR) << "Failed to add config proxy for: " << uri << "/" << name;
} }
} }
}; };
...@@ -166,7 +173,7 @@ static void run(ftl::Configurable *root) { ...@@ -166,7 +173,7 @@ static void run(ftl::Configurable *root) {
LOG(ERROR) << "No sources configured!"; LOG(ERROR) << "No sources configured!";
return; return;
} }
ConfigProxy *configproxy = nullptr; ConfigProxy *configproxy = nullptr;
if (net->numberOfPeers() > 0) { if (net->numberOfPeers() > 0) {
configproxy = new ConfigProxy(net); // TODO delete configproxy = new ConfigProxy(net); // TODO delete
...@@ -174,6 +181,8 @@ static void run(ftl::Configurable *root) { ...@@ -174,6 +181,8 @@ static void run(ftl::Configurable *root) {
configproxy->add(disparity, "source/disparity/algorithm", "algorithm"); configproxy->add(disparity, "source/disparity/algorithm", "algorithm");
configproxy->add(disparity, "source/disparity/bilateral_filter", "bilateral_filter"); configproxy->add(disparity, "source/disparity/bilateral_filter", "bilateral_filter");
configproxy->add(disparity, "source/disparity/optflow_filter", "optflow_filter"); configproxy->add(disparity, "source/disparity/optflow_filter", "optflow_filter");
configproxy->add(disparity, "source/disparity/mls", "mls");
configproxy->add(disparity, "source/disparity/cross", "cross");
} }
// Create scene transform, intended for axis aligning the walls and floor // Create scene transform, intended for axis aligning the walls and floor
...@@ -289,7 +298,7 @@ static void run(ftl::Configurable *root) { ...@@ -289,7 +298,7 @@ static void run(ftl::Configurable *root) {
// TODO: Write pose+calibration+config packets // TODO: Write pose+calibration+config packets
auto sources = group->sources(); auto sources = group->sources();
for (int i=0; i<sources.size(); ++i) { for (size_t i=0; i<sources.size(); ++i) {
//writeSourceProperties(writer, i, sources[i]); //writeSourceProperties(writer, i, sources[i]);
sources[i]->inject(Channel::Calibration, sources[i]->parameters(), Channel::Left, sources[i]->getCapabilities()); sources[i]->inject(Channel::Calibration, sources[i]->parameters(), Channel::Left, sources[i]->getCapabilities());
sources[i]->inject(sources[i]->getPose()); sources[i]->inject(sources[i]->getPose());
......
...@@ -10,7 +10,6 @@ set(OPERSRC ...@@ -10,7 +10,6 @@ set(OPERSRC
src/filling.cu src/filling.cu
src/disparity/disp2depth.cu src/disparity/disp2depth.cu
src/disparity/disparity_to_depth.cpp src/disparity/disparity_to_depth.cpp
src/disparity/fixstars_sgm.cpp
src/disparity/bilateral_filter.cpp src/disparity/bilateral_filter.cpp
src/segmentation.cu src/segmentation.cu
src/segmentation.cpp src/segmentation.cpp
...@@ -20,6 +19,11 @@ set(OPERSRC ...@@ -20,6 +19,11 @@ set(OPERSRC
src/antialiasing.cu src/antialiasing.cu
) )
if (LIBSGM_FOUND)
list(APPEND OPERSRC src/disparity/fixstars_sgm.cpp)
endif (LIBSGM_FOUND)
if (HAVE_OPTFLOW) if (HAVE_OPTFLOW)
list(APPEND OPERSRC list(APPEND OPERSRC
src/nvopticalflow.cpp src/nvopticalflow.cpp
......
...@@ -7,16 +7,18 @@ ...@@ -7,16 +7,18 @@
#include <opencv2/cudaoptflow.hpp> #include <opencv2/cudaoptflow.hpp>
#endif #endif
#ifdef HAVE_LIBSGM
#include <libsgm.h> #include <libsgm.h>
#endif
namespace ftl { namespace ftl {
namespace operators { namespace operators {
#ifdef HAVE_LIBSGM
/* /*
* FixstarsSGM https://github.com/fixstars/libSGM * FixstarsSGM https://github.com/fixstars/libSGM
* *
* Requires modified version https://gitlab.utu.fi/joseha/libsgm * Requires modified version https://gitlab.utu.fi/joseha/libsgm
*
*/ */
class FixstarsSGM : public ftl::operators::Operator { class FixstarsSGM : public ftl::operators::Operator {
public: public:
...@@ -41,6 +43,7 @@ class FixstarsSGM : public ftl::operators::Operator { ...@@ -41,6 +43,7 @@ class FixstarsSGM : public ftl::operators::Operator {
int max_disp_; int max_disp_;
float uniqueness_; float uniqueness_;
}; };
#endif
class DisparityBilateralFilter : public::ftl::operators::Operator { class DisparityBilateralFilter : public::ftl::operators::Operator {
public: public:
......
...@@ -14,12 +14,12 @@ namespace operators { ...@@ -14,12 +14,12 @@ namespace operators {
*/ */
class DiscontinuityMask : public ftl::operators::Operator { class DiscontinuityMask : public ftl::operators::Operator {
public: public:
explicit DiscontinuityMask(ftl::Configurable*); explicit DiscontinuityMask(ftl::Configurable*);
~DiscontinuityMask(); ~DiscontinuityMask();
inline Operator::Type type() const override { return Operator::Type::OneToOne; } inline Operator::Type type() const override { return Operator::Type::OneToOne; }
bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, ftl::rgbd::Source *src, cudaStream_t stream) override; bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, ftl::rgbd::Source *src, cudaStream_t stream) override;
}; };
...@@ -28,12 +28,12 @@ class DiscontinuityMask : public ftl::operators::Operator { ...@@ -28,12 +28,12 @@ class DiscontinuityMask : public ftl::operators::Operator {
*/ */
class CullDiscontinuity : public ftl::operators::Operator { class CullDiscontinuity : public ftl::operators::Operator {
public: public:
explicit CullDiscontinuity(ftl::Configurable*); explicit CullDiscontinuity(ftl::Configurable*);
~CullDiscontinuity(); ~CullDiscontinuity();
inline Operator::Type type() const override { return Operator::Type::OneToOne; } inline Operator::Type type() const override { return Operator::Type::OneToOne; }
bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, ftl::rgbd::Source *src, cudaStream_t stream) override; bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, ftl::rgbd::Source *src, cudaStream_t stream) override;
}; };
......
...@@ -253,6 +253,11 @@ bool AggreMLS::apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, ftl::rgbd::Sou ...@@ -253,6 +253,11 @@ bool AggreMLS::apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, ftl::rgbd::Sou
return false; return false;
} }
if (!in.hasChannel(Channel::Support1)) {
LOG(ERROR) << "Required support channel missing for MLS";
return false;
}
auto size = in.get<GpuMat>(Channel::Depth).size(); auto size = in.get<GpuMat>(Channel::Depth).size();
centroid_horiz_.create(size.height, size.width); centroid_horiz_.create(size.height, size.width);
normals_horiz_.create(size.height, size.width); normals_horiz_.create(size.height, size.width);
......
...@@ -8,7 +8,14 @@ ...@@ -8,7 +8,14 @@
#include "ftl/operators/opticalflow.hpp" #include "ftl/operators/opticalflow.hpp"
#endif #endif
#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/disparity.hpp" #include "ftl/operators/disparity.hpp"
#include "ftl/operators/mask.hpp"
#include "ftl/threads.hpp" #include "ftl/threads.hpp"
#include "calibrate.hpp" #include "calibrate.hpp"
...@@ -132,6 +139,11 @@ void StereoVideoSource::init(const string &file) { ...@@ -132,6 +139,11 @@ void StereoVideoSource::init(const string &file) {
#endif #endif
pipeline_depth_->append<ftl::operators::DisparityBilateralFilter>("bilateral_filter"); pipeline_depth_->append<ftl::operators::DisparityBilateralFilter>("bilateral_filter");
pipeline_depth_->append<ftl::operators::DisparityToDepth>("calculate_depth"); pipeline_depth_->append<ftl::operators::DisparityToDepth>("calculate_depth");
pipeline_depth_->append<ftl::operators::ColourChannels>("colour"); // Convert BGR to BGRA
pipeline_depth_->append<ftl::operators::Normals>("normals"); // Estimate surface normals
pipeline_depth_->append<ftl::operators::CrossSupport>("cross");
pipeline_depth_->append<ftl::operators::DiscontinuityMask>("discontinuity_mask");
pipeline_depth_->append<ftl::operators::AggreMLS>("mls"); // Perform MLS (using smoothing channel)
LOG(INFO) << "StereoVideo source ready..."; LOG(INFO) << "StereoVideo source ready...";
ready_ = true; ready_ = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment