From f4ffecd341c10badee75df75ac9f44fa87aab1e2 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Tue, 20 May 2014 12:31:55 -0400 Subject: [PATCH] fixed exclusion of FTE scores --- openbr/openbr_plugin.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/openbr/openbr_plugin.cpp b/openbr/openbr_plugin.cpp index 3fd52a8..c0259b6 100644 --- a/openbr/openbr_plugin.cpp +++ b/openbr/openbr_plugin.cpp @@ -1389,10 +1389,17 @@ QList Distance::compare(const TemplateList &targets, const Template &quer float Distance::compare(const Template &a, const Template &b) const { float similarity = 0; - foreach (const cv::Mat &ma, a) - foreach (const cv::Mat &mb, b) - similarity += compare(ma, mb); - const int comparisons = a.size() * b.size(); + int comparisons = 0; + foreach (const cv::Mat &ma, a) { + foreach (const cv::Mat &mb, b) { + const float score = compare(ma, mb); + if (score != -std::numeric_limits::max()) { + similarity += score; + comparisons++; + } + } + } + if (comparisons > 0) similarity /= comparisons; else similarity = -std::numeric_limits::max(); return similarity; -- libgit2 0.21.4