Commit bd736b99465dfdd94df481ae5a30402cd05bee63

Authored by Josh Klontz
1 parent 64c0a61e

fixed janus edge cases

1   -Subproject commit cdac0b653134087198dd9230bc0956d4dfab4b85
  1 +Subproject commit 8b92f413569ed1f4aee4cae5f5f09c607be1f0c7
... ...
openbr/janus.cpp
... ... @@ -74,6 +74,7 @@ janus_error janus_augment(const janus_image image, const janus_attribute_list at
74 74  
75 75 janus_error janus_finalize_template(janus_template template_, janus_flat_template flat_template, size_t *bytes)
76 76 {
  77 + *bytes = 0;
77 78 foreach (const cv::Mat &m, *template_) {
78 79 assert(m.isContinuous());
79 80 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
118 119 if (*similarity != *similarity) // True for NaN
119 120 return JANUS_UNKNOWN_ERROR;
120 121  
121   - *similarity /= comparisons;
  122 + if (comparisons > 0) *similarity /= comparisons;
  123 + else *similarity = std::numeric_limits<double>::lowest();
122 124 return JANUS_SUCCESS;
123 125 }
124 126  
... ...