Commit 55756d38c86e2c7bef241e8691b5ac48edd777b8

Authored by Josh Klontz
1 parent 2f170bc1

added age filter

sdk/openbr_plugin.cpp
@@ -1256,6 +1256,13 @@ float Distance::compare(const Template &target, const Template &query) const @@ -1256,6 +1256,13 @@ float Distance::compare(const Template &target, const Template &query) const
1256 } 1256 }
1257 } 1257 }
1258 1258
  1259 + if (Globals->ageDelta < std::numeric_limits<float>::max()) {
  1260 + const float targetAge = target.file.getFloat("Age", -1);
  1261 + const float queryAge = target.file.getFloat("Age", -1);
  1262 + if ((targetAge != -1) && (queryAge != -1) && (abs(targetAge - queryAge) > Globals->ageDelta))
  1263 + return -std::numeric_limits<float>::max();
  1264 + }
  1265 +
1259 return a * (_compare(target, query) - b); 1266 return a * (_compare(target, query) - b);
1260 } 1267 }
1261 1268
sdk/openbr_plugin.h
@@ -488,9 +488,15 @@ public: @@ -488,9 +488,15 @@ public:
488 /*! 488 /*!
489 * \brief Keys to use when matching templates to automatically determine non-match based on template metadata. 489 * \brief Keys to use when matching templates to automatically determine non-match based on template metadata.
490 */ 490 */
491 - Q_PROPERTY(QStringList demographicFilters READ get_demographicFilters WRITE set_demographicFilters) 491 + Q_PROPERTY(QStringList demographicFilters READ get_demographicFilters WRITE set_demographicFilters RESET reset_demographicFilters)
492 BR_PROPERTY(QStringList, demographicFilters, QStringList()) 492 BR_PROPERTY(QStringList, demographicFilters, QStringList())
493 493
  494 + /*!
  495 + * \brief Allowable age difference when matching templates.
  496 + */
  497 + Q_PROPERTY(float ageDelta READ get_ageDelta WRITE set_ageDelta RESET reset_ageDelta)
  498 + BR_PROPERTY(float, ageDelta, std::numeric_limits<float>::max())
  499 +
494 QHash<QString,QString> abbreviations; /*!< \brief Used by br::Transform::make() to expand abbreviated algorithms into their complete definitions. */ 500 QHash<QString,QString> abbreviations; /*!< \brief Used by br::Transform::make() to expand abbreviated algorithms into their complete definitions. */
495 QHash<QString,int> classes; /*!< \brief Used by classifiers to associate text class labels with unique integers IDs. */ 501 QHash<QString,int> classes; /*!< \brief Used by classifiers to associate text class labels with unique integers IDs. */
496 QTime startTime; /*!< \brief Used to estimate timeRemaining(). */ 502 QTime startTime; /*!< \brief Used to estimate timeRemaining(). */