Commit f4ffecd341c10badee75df75ac9f44fa87aab1e2
1 parent
6b3de1b3
fixed exclusion of FTE scores
Showing
1 changed file
with
11 additions
and
4 deletions
openbr/openbr_plugin.cpp
| ... | ... | @@ -1389,10 +1389,17 @@ QList<float> Distance::compare(const TemplateList &targets, const Template &quer |
| 1389 | 1389 | float Distance::compare(const Template &a, const Template &b) const |
| 1390 | 1390 | { |
| 1391 | 1391 | float similarity = 0; |
| 1392 | - foreach (const cv::Mat &ma, a) | |
| 1393 | - foreach (const cv::Mat &mb, b) | |
| 1394 | - similarity += compare(ma, mb); | |
| 1395 | - const int comparisons = a.size() * b.size(); | |
| 1392 | + int comparisons = 0; | |
| 1393 | + foreach (const cv::Mat &ma, a) { | |
| 1394 | + foreach (const cv::Mat &mb, b) { | |
| 1395 | + const float score = compare(ma, mb); | |
| 1396 | + if (score != -std::numeric_limits<float>::max()) { | |
| 1397 | + similarity += score; | |
| 1398 | + comparisons++; | |
| 1399 | + } | |
| 1400 | + } | |
| 1401 | + } | |
| 1402 | + | |
| 1396 | 1403 | if (comparisons > 0) similarity /= comparisons; |
| 1397 | 1404 | else similarity = -std::numeric_limits<float>::max(); |
| 1398 | 1405 | return similarity; | ... | ... |