Commit e0ebc6fc514a2bd6b099cc5125ce0c6b800defcb
1 parent
cef8cb90
added matchprobability support for raw feature vectors
Showing
1 changed file
with
13 additions
and
4 deletions
openbr/plugins/quality.cpp
| @@ -184,10 +184,19 @@ class MatchProbabilityDistance : public Distance | @@ -184,10 +184,19 @@ class MatchProbabilityDistance : public Distance | ||
| 184 | 184 | ||
| 185 | float compare(const cv::Mat &target, const cv::Mat &query) const | 185 | float compare(const cv::Mat &target, const cv::Mat &query) const |
| 186 | { | 186 | { |
| 187 | - const float rawScore = distance->compare(target, query); | ||
| 188 | - if (rawScore == -std::numeric_limits<float>::max()) return rawScore; | ||
| 189 | - if (!Globals->scoreNormalization) return -log(rawScore+1); | ||
| 190 | - return mp(rawScore, gaussian); | 187 | + return normalize(distance->compare(target, query)); |
| 188 | + } | ||
| 189 | + | ||
| 190 | + float compare(const uchar *a, const uchar *b, size_t size) const | ||
| 191 | + { | ||
| 192 | + return normalize(distance->compare(a, b, size)); | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + float normalize(float score) const | ||
| 196 | + { | ||
| 197 | + if (score == -std::numeric_limits<float>::max()) return score; | ||
| 198 | + if (!Globals->scoreNormalization) return -log(score+1); | ||
| 199 | + return mp(score, gaussian); | ||
| 191 | } | 200 | } |
| 192 | 201 | ||
| 193 | void store(QDataStream &stream) const | 202 | void store(QDataStream &stream) const |