From 760c7c00b471b13f943190c1c0b605302077ecf8 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Wed, 23 Jan 2013 14:50:55 -0500 Subject: [PATCH] improved/fixed demographic filter thread safety --- sdk/openbr_plugin.cpp | 5 +++-- sdk/openbr_plugin.h | 5 ++--- 2 files changed, 5 insertions(+), 5 deletions(-) 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()) -- libgit2 0.21.4