From bd736b99465dfdd94df481ae5a30402cd05bee63 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Mon, 5 May 2014 11:56:08 -0400 Subject: [PATCH] fixed janus edge cases --- openbr/janus | 2 +- openbr/janus.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/openbr/janus b/openbr/janus index cdac0b6..8b92f41 160000 --- a/openbr/janus +++ b/openbr/janus @@ -1 +1 @@ -Subproject commit cdac0b653134087198dd9230bc0956d4dfab4b85 +Subproject commit 8b92f413569ed1f4aee4cae5f5f09c607be1f0c7 diff --git a/openbr/janus.cpp b/openbr/janus.cpp index 53360e9..9494fcf 100644 --- a/openbr/janus.cpp +++ b/openbr/janus.cpp @@ -74,6 +74,7 @@ janus_error janus_augment(const janus_image image, const janus_attribute_list at janus_error janus_finalize_template(janus_template template_, janus_flat_template flat_template, size_t *bytes) { + *bytes = 0; foreach (const cv::Mat &m, *template_) { assert(m.isContinuous()); const size_t templateBytes = m.rows * m.cols * m.elemSize(); @@ -118,7 +119,8 @@ janus_error janus_verify(const janus_flat_template a, const size_t a_bytes, cons if (*similarity != *similarity) // True for NaN return JANUS_UNKNOWN_ERROR; - *similarity /= comparisons; + if (comparisons > 0) *similarity /= comparisons; + else *similarity = std::numeric_limits::lowest(); return JANUS_SUCCESS; } -- libgit2 0.21.4