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

Config change to census shape

parent 9bcd8d9e
No related branches found
No related tags found
1 merge request!351Circle census transform or SGM
Pipeline #33087 passed
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#ifdef HAVE_LIBSGM #ifdef HAVE_LIBSGM
#include <libsgm.h> #include <libsgm.h>
#include <libsgm_parameters.hpp>
#include <opencv2/cudaimgproc.hpp> #include <opencv2/cudaimgproc.hpp>
#endif #endif
...@@ -85,6 +86,7 @@ class FixstarsSGM : public ftl::operators::Operator { ...@@ -85,6 +86,7 @@ class FixstarsSGM : public ftl::operators::Operator {
int max_disp_; int max_disp_;
float uniqueness_; float uniqueness_;
bool use_P2_map_; bool use_P2_map_;
sgm::CensusShape ct_shape_;
}; };
#endif #endif
......
...@@ -64,6 +64,7 @@ FixstarsSGM::FixstarsSGM(ftl::operators::Graph *g, ftl::Configurable* cfg) : ...@@ -64,6 +64,7 @@ FixstarsSGM::FixstarsSGM(ftl::operators::Graph *g, ftl::Configurable* cfg) :
P1_ = cfg->value("P1", 10); P1_ = cfg->value("P1", 10);
P2_ = cfg->value("P2", 120); P2_ = cfg->value("P2", 120);
max_disp_ = cfg->value("num_disp", 256); max_disp_ = cfg->value("num_disp", 256);
ct_shape_ = static_cast<sgm::CensusShape>(cfg->value("ct_shape", 2));
if (uniqueness_ < 0.0 || uniqueness_ > 1.0) { if (uniqueness_ < 0.0 || uniqueness_ > 1.0) {
uniqueness_ = 1.0; uniqueness_ = 1.0;
...@@ -118,6 +119,11 @@ FixstarsSGM::FixstarsSGM(ftl::operators::Graph *g, ftl::Configurable* cfg) : ...@@ -118,6 +119,11 @@ FixstarsSGM::FixstarsSGM(ftl::operators::Graph *g, ftl::Configurable* cfg) :
} }
}); });
cfg->on("ct_shape", [this, cfg]() {
ct_shape_ = static_cast<sgm::CensusShape>(cfg->value("ct_shape", 2));
updateParameters();
});
updateP2Parameters(); updateP2Parameters();
cfg->on("canny_low", [this, cfg]() { cfg->on("canny_low", [this, cfg]() {
...@@ -159,7 +165,7 @@ bool FixstarsSGM::init() { ...@@ -159,7 +165,7 @@ bool FixstarsSGM::init() {
bool FixstarsSGM::updateParameters() { bool FixstarsSGM::updateParameters() {
if (ssgm_ == nullptr) { return false; } if (ssgm_ == nullptr) { return false; }
return this->ssgm_->updateParameters( return this->ssgm_->updateParameters(
sgm::StereoSGM::Parameters(P1_, P2_, uniqueness_, true)); sgm::StereoSGM::Parameters(P1_, P2_, uniqueness_, true, ct_shape_));
} }
bool FixstarsSGM::updateP2Parameters() { bool FixstarsSGM::updateP2Parameters() {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
namespace sgm { namespace sgm {
enum class CensusShape { enum class CensusShape {
CT_5X5, CT_5X5=0,
CS_CT_9X7, CS_CT_9X7,
CIRCLE_3 CIRCLE_3
}; };
......
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