From ad02b72b78eb674540d114a7991c24b9cf15c4ab Mon Sep 17 00:00:00 2001 From: Sebastian Hahta <joseha@utu.fi> Date: Fri, 17 Apr 2020 13:57:59 +0300 Subject: [PATCH] linear weights to dual.hpp --- lib/libstereo/src/costs/dual.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/libstereo/src/costs/dual.hpp b/lib/libstereo/src/costs/dual.hpp index 6ee5d15d2..07bc49de9 100644 --- a/lib/libstereo/src/costs/dual.hpp +++ b/lib/libstereo/src/costs/dual.hpp @@ -17,11 +17,13 @@ namespace impl { cost_a(w,h,dmin,dmax), cost_b(w,h,dmin,dmax) {} __host__ __device__ inline unsigned short operator()(const int y, const int x, const int d) const { - return (cost_a(y, x, d) + cost_b(y, x, d)); + return cost_a(y,x,d)*wa + cost_b(y,x,d)*wb; } A cost_a; B cost_b; + float wa = 1.0; + float wb = 1.0; }; } @@ -41,6 +43,11 @@ public: this->data().cost_b = cost_b.data(); } + void setWeights(float a, float b) { + this->data().wa = a; + this->data().wb = b; + } + static constexpr short COST_MAX = A::COST_MAX + B::COST_MAX; protected: -- GitLab