diff --git a/sdk/openbr_plugin.cpp b/sdk/openbr_plugin.cpp index 666437c..1270fe5 100644 --- a/sdk/openbr_plugin.cpp +++ b/sdk/openbr_plugin.cpp @@ -1318,8 +1318,9 @@ float Distance::compare(const Template &target, const Template &query) const if (!Globals->demographicFilters.isEmpty()) // If statement is faster than iterating over an empty list of filters foreach (const QString &filter, Globals->demographicFilters.keys()) { const QString targetMetadata = target.file.getString(filter, ""); - if (!targetMetadata.isEmpty() && - (Globals->demographicFilters[filter].indexIn(targetMetadata) == -1)) + if (targetMetadata.isEmpty()) continue; + const QRegExp re(Globals->demographicFilters[filter]); + if (re.indexIn(targetMetadata) == -1) return -std::numeric_limits::max(); } diff --git a/sdk/openbr_plugin.h b/sdk/openbr_plugin.h index 371f567..24450ae 100644 --- a/sdk/openbr_plugin.h +++ b/sdk/openbr_plugin.h @@ -496,10 +496,9 @@ public: BR_PROPERTY(bool, enrollAll, false) /*! - * \brief Keys to use when matching templates to automatically determine non-match based on template metadata. + * \brief Regular expressions that automatically determine impostor matches based on target (gallery) template metadata. */ - - typedef QHash DemographicFilters; + typedef QHash DemographicFilters; Q_PROPERTY(DemographicFilters demographicFilters READ get_demographicFilters WRITE set_demographicFilters RESET reset_demographicFilters) BR_PROPERTY(DemographicFilters, demographicFilters, DemographicFilters())