Commit 760c7c00b471b13f943190c1c0b605302077ecf8

Authored by Josh Klontz
1 parent 28ac05ec

improved/fixed demographic filter thread safety

sdk/openbr_plugin.cpp
... ... @@ -1318,8 +1318,9 @@ float Distance::compare(const Template &target, const Template &query) const
1318 1318 if (!Globals->demographicFilters.isEmpty()) // If statement is faster than iterating over an empty list of filters
1319 1319 foreach (const QString &filter, Globals->demographicFilters.keys()) {
1320 1320 const QString targetMetadata = target.file.getString(filter, "");
1321   - if (!targetMetadata.isEmpty() &&
1322   - (Globals->demographicFilters[filter].indexIn(targetMetadata) == -1))
  1321 + if (targetMetadata.isEmpty()) continue;
  1322 + const QRegExp re(Globals->demographicFilters[filter]);
  1323 + if (re.indexIn(targetMetadata) == -1)
1323 1324 return -std::numeric_limits<float>::max();
1324 1325 }
1325 1326  
... ...
sdk/openbr_plugin.h
... ... @@ -496,10 +496,9 @@ public:
496 496 BR_PROPERTY(bool, enrollAll, false)
497 497  
498 498 /*!
499   - * \brief Keys to use when matching templates to automatically determine non-match based on template metadata.
  499 + * \brief Regular expressions that automatically determine impostor matches based on target (gallery) template metadata.
500 500 */
501   -
502   - typedef QHash<QString,QRegExp> DemographicFilters;
  501 + typedef QHash<QString,QString> DemographicFilters;
503 502 Q_PROPERTY(DemographicFilters demographicFilters READ get_demographicFilters WRITE set_demographicFilters RESET reset_demographicFilters)
504 503 BR_PROPERTY(DemographicFilters, demographicFilters, DemographicFilters())
505 504  
... ...