From 9b2cfd5b75c60d64c85ffacfefdf7ceae3e730f3 Mon Sep 17 00:00:00 2001 From: Scott Klum Date: Mon, 22 Apr 2013 19:20:35 -0400 Subject: [PATCH] Premerge commit --- openbr/core/bee.cpp | 3 +++ openbr/openbr_plugin.cpp | 2 +- openbr/openbr_plugin.h | 2 +- openbr/plugins/distance.cpp | 5 ++++- openbr/plugins/misc.cpp | 2 +- openbr/plugins/stasm.cpp | 16 +++++++--------- 6 files changed, 17 insertions(+), 13 deletions(-) diff --git a/openbr/core/bee.cpp b/openbr/core/bee.cpp index 4d5bfcf..5b93370 100644 --- a/openbr/core/bee.cpp +++ b/openbr/core/bee.cpp @@ -265,6 +265,9 @@ cv::Mat BEE::makeMask(const br::FileList &targets, const br::FileList &queries, QList targetPartitions = targets.crossValidationPartitions(); QList queryPartitions = queries.crossValidationPartitions(); + for (int i = 0; i < 5; i++) qDebug() << "QueryPartition " << queries[i].fileName() << ": " << queryPartitions[i]; + for (int i = 0; i < 5; i++) qDebug() << "TargetPartition " << targets[i].fileName() << ": " << targetPartitions[i]; + Mat mask(queries.size(), targets.size(), CV_8UC1); for (int i=0; i i(Gallery::make(file)); TemplateList newTemplates = i->read(); @@ -424,7 +425,6 @@ TemplateList TemplateList::fromGallery(const br::File &gallery) const int crossValidate = gallery.get("crossValidate"); if (crossValidate > 0) srand(0); - // Propogate metadata for (int i=newTemplates.size()-1; i>=0; i--) { newTemplates[i].file.append(gallery.localMetadata()); newTemplates[i].file.append(file.localMetadata()); diff --git a/openbr/openbr_plugin.h b/openbr/openbr_plugin.h index 531493d..9164e4c 100644 --- a/openbr/openbr_plugin.h +++ b/openbr/openbr_plugin.h @@ -299,7 +299,7 @@ struct BR_EXPORT FileList : public QList * \brief A list of matrices associated with a file. * * The br::Template is one of the workhorse classes in OpenBR. - * A template represents a biometric at various stages of enrollment and can be modified br::Transform and compared to other templates with br::Distance. + * A template represents a biometric at various stages of enrollment and can be modified by br::Transform and compared to other templates with br::Distance. * * While there exist many cases (ex. video enrollment, multiple face detects, per-patch subspace learning, ...) where the template will contain more than one matrix, * in most cases templates have exactly one matrix in their list representing a single image at various stages of enrollment. diff --git a/openbr/plugins/distance.cpp b/openbr/plugins/distance.cpp index f0eb470..6a809af 100644 --- a/openbr/plugins/distance.cpp +++ b/openbr/plugins/distance.cpp @@ -197,7 +197,10 @@ class AverageDistance : public Distance if (a.size() != b.size()) qFatal("Comparison size mismatch"); float score = 0; - for (int i = 0; i < a.size(); i++) score += distance->compare(a[i],b[i]); + for (int i = 0; i < a.size(); i++) { + qDebug() << "Computing score for: " << a.file.name << " vs. " << b.file.name; + score += distance->compare(a[i],b[i]); + } return score/(float)a.size(); } diff --git a/openbr/plugins/misc.cpp b/openbr/plugins/misc.cpp index 35dd638..26711b2 100644 --- a/openbr/plugins/misc.cpp +++ b/openbr/plugins/misc.cpp @@ -307,7 +307,7 @@ BR_REGISTER(Transform, LabelTransform) /*! * \ingroup transforms - * \brief Name a point + * \brief Remove a name from a point * \author Scott Klum \cite sklum */ class AnonymizeTransform : public UntrainableMetaTransform diff --git a/openbr/plugins/stasm.cpp b/openbr/plugins/stasm.cpp index d905296..d7bee87 100644 --- a/openbr/plugins/stasm.cpp +++ b/openbr/plugins/stasm.cpp @@ -33,15 +33,13 @@ BR_REGISTER(Initializer, StasmInitializer) * \brief Wraps STASM key point detector * \author Scott Klum \cite sklum */ -// TODO: Use a global mutex to prevent concurrent calls to AsmSearchDll - class StasmTransform : public UntrainableTransform { Q_OBJECT void init() { - Globals->setProperty("parallelism", "0"); // Can only work in single threaded mode + // Load models } void project(const Template &src, Template &dst) const @@ -49,22 +47,22 @@ class StasmTransform : public UntrainableTransform static QMutex mutex; QMutexLocker locker(&mutex); - int nlandmarks; + int numLandmarks; int landmarks[500]; - AsmSearchDll(&nlandmarks, landmarks, - qPrintable(src.file.name), reinterpret_cast(src.m().data), src.m().cols, src.m().rows, - src.m(), (src.m().channels() == 3), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/mu-68-1d.conf"), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/mu-76-2d.conf"), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/")); + AsmSearchDll(numLandmarks, landmarks, qPrintable(src.file.name), reinterpret_cast(src.m().data), src.m(), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/mu-68-1d.conf"), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/mu-76-2d.conf"), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/")); - if (nlandmarks == 0) { + if (numLandmarks == 0) { qWarning("Unable to detect Stasm landmarks for %s", qPrintable(src.file.fileName())); dst.file.set("FTE", true); dst.m() = src.m(); return; } - for (int i = 0; i < nlandmarks; i++) + for (int i = 0; i < numLandmarks; i++) { + qDebug() << QPointF(landmarks[2 * i], landmarks[2 * i + 1]); dst.file.appendPoint(QPointF(landmarks[2 * i], landmarks[2 * i + 1])); + } dst.m() = src.m(); } -- libgit2 0.21.4