From b735d7791a8e1eb60a1fc00c5b294e304ad3a28e Mon Sep 17 00:00:00 2001 From: Scott Klum Date: Mon, 12 Oct 2015 10:06:36 -0400 Subject: [PATCH] Stasm uses rects or metadata key rect now --- 3rdparty/stasm4.0.0/stasm/MOD_1/facedet.h | 6 ++---- openbr/plugins/core/algorithms.cpp | 2 +- openbr/plugins/metadata/stasm4.cpp | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/3rdparty/stasm4.0.0/stasm/MOD_1/facedet.h b/3rdparty/stasm4.0.0/stasm/MOD_1/facedet.h index d7b25e9..487226a 100755 --- a/3rdparty/stasm4.0.0/stasm/MOD_1/facedet.h +++ b/3rdparty/stasm4.0.0/stasm/MOD_1/facedet.h @@ -38,13 +38,11 @@ public: FaceDet() {} // constructor - - vector detpars_; // all the valid faces in the current image - -private: int iface_; // index of current face for NextFace_ // indexes into detpars_ + vector detpars_; // all the valid faces in the current image +private: DISALLOW_COPY_AND_ASSIGN(FaceDet); }; // end class FaceDet diff --git a/openbr/plugins/core/algorithms.cpp b/openbr/plugins/core/algorithms.cpp index 6f3b183..17e93a0 100644 --- a/openbr/plugins/core/algorithms.cpp +++ b/openbr/plugins/core/algorithms.cpp @@ -39,7 +39,7 @@ class AlgorithmsInitializer : public Initializer Globals->abbreviations.insert("FR_Mouth", "(CropFromLandmarks([59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76])+Resize(24,48))"); Globals->abbreviations.insert("FR_Nose", "(CropFromLandmarks([16,17,18,19,20,21,22,23,24,25,26,27],padding=3)+Resize(36,36))"); Globals->abbreviations.insert("FR_Face", "(Crop(24,24,88,88)+Resize(44,44))"); - Globals->abbreviations.insert("FR_Detect", "(Open+Cvt(Gray)+Stasm+Rename(StasmLeftEye,Affine_1,true)+Rename(StasmRightEye,Affine_0,true)+Affine(136,136,0.35,0.35,warpPoints=true))"); + Globals->abbreviations.insert("FR_Detect", "(Open+Cvt(Gray)+Cascade+Stasm+Rename(StasmLeftEye,Affine_1,true)+Rename(StasmRightEye,Affine_0,true)+Affine(136,136,0.35,0.35,warpPoints=true))"); Globals->abbreviations.insert("FR_Represent", "((DenseHOG/DenseLBP)+Cat+LDA(.98)+Normalize(L2))"); Globals->abbreviations.insert("GenderClassification", "FaceDetection+Expand+FaceClassificationRegistration+Expand+++Discard"); diff --git a/openbr/plugins/metadata/stasm4.cpp b/openbr/plugins/metadata/stasm4.cpp index 9ee985e..4305156 100644 --- a/openbr/plugins/metadata/stasm4.cpp +++ b/openbr/plugins/metadata/stasm4.cpp @@ -67,6 +67,8 @@ class StasmTransform : public UntrainableMetaTransform BR_PROPERTY(QList, pinPoints, QList()) Q_PROPERTY(QStringList pinLabels READ get_pinLabels WRITE set_pinLabels RESET reset_pinLabels STORED false) BR_PROPERTY(QStringList, pinLabels, QStringList()) + Q_PROPERTY(QString inputVariable READ get_inputVariable WRITE set_inputVariable RESET reset_inputVariable STORED false) + BR_PROPERTY(QString, inputVariable, "FrontalFace") Resource stasmCascadeResource; @@ -158,6 +160,21 @@ class StasmTransform : public UntrainableMetaTransform StasmCascadeClassifier *stasmCascade = stasmCascadeResource.acquire(); foundFace = 1; stasm::FaceDet detection; + + QList rects = t.file.contains(inputVariable) ? QList() << t.file.get(inputVariable) : t.file.rects(); + if (!rects.isEmpty()) detection.iface_ = 0; + for (int i=0; i(stasmSrc.data), stasmSrc.cols, stasmSrc.rows, *stasmCascade, detection); if (foundFace) { -- libgit2 0.21.4