Commit cf3f79379cdf68c3b53fce5339686c7c03558128

Authored by Scott Klum
2 parents 163c2706 99e31d42

Merge branch 'master' of https://github.com/biometrics/openbr

Showing 1 changed file with 34 additions and 0 deletions
openbr/plugins/distance.cpp
... ... @@ -244,6 +244,40 @@ BR_REGISTER(Distance, HalfByteL1Distance)
244 244  
245 245 /*!
246 246 * \ingroup distances
  247 + * \brief Returns -log(distance(a,b)+1)
  248 + * \author Josh Klontz \cite jklontz
  249 + */
  250 +class NegativeLogPlusOneDistance : public Distance
  251 +{
  252 + Q_OBJECT
  253 + Q_PROPERTY(br::Distance* distance READ get_distance WRITE set_distance RESET reset_distance STORED false)
  254 + BR_PROPERTY(br::Distance*, distance, NULL)
  255 +
  256 + void train(const TemplateList &src)
  257 + {
  258 + distance->train(src);
  259 + }
  260 +
  261 + float compare(const Template &a, const Template &b) const
  262 + {
  263 + return -log(distance->compare(a,b)+1);
  264 + }
  265 +
  266 + void store(QDataStream &stream) const
  267 + {
  268 + distance->store(stream);
  269 + }
  270 +
  271 + void load(QDataStream &stream)
  272 + {
  273 + distance->load(stream);
  274 + }
  275 +};
  276 +
  277 +BR_REGISTER(Distance, NegativeLogPlusOneDistance)
  278 +
  279 +/*!
  280 + * \ingroup distances
247 281 * \brief Returns \c true if the templates are identical, \c false otherwise.
248 282 * \author Josh Klontz \cite jklontz
249 283 */
... ...