diff --git a/sdk/plugins/format.cpp b/sdk/plugins/format.cpp index 6bfb772..ed5ed3d 100644 --- a/sdk/plugins/format.cpp +++ b/sdk/plugins/format.cpp @@ -44,6 +44,7 @@ class videoFormat : public Format public: Template read() const { + //if (file.exists()) { VideoCapture videoSource(file.name.toStdString()); videoSource.open(file.name.toStdString() ); @@ -65,6 +66,7 @@ public: } return frames; + //} } void write(const Template &t) const diff --git a/sdk/plugins/pbd.cpp b/sdk/plugins/pbd.cpp index 94fc40f..f9e8b86 100644 --- a/sdk/plugins/pbd.cpp +++ b/sdk/plugins/pbd.cpp @@ -34,11 +34,11 @@ class PBDInitializer : public Initializer void initialize() const { - Globals->abbreviations.insert("RectFromEyes","RectFromLandmarks([9, 10, 11, 12, 13, 14, 20, 21, 22, 23, 24, 25],10,6.0)"); - Globals->abbreviations.insert("RectFromNose","RectFromLandmarks([0, 1, 2, 3, 4, 5, 6, 7, 8],10)"); - Globals->abbreviations.insert("RectFromBrow","RectFromLandmarks([15, 16, 17, 18, 19, 26, 27, 28, 29, 30],10)"); - Globals->abbreviations.insert("RectFromMouth","RectFromLandmarks([31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],10)"); - Globals->abbreviations.insert("RectFromJaw","RectFromLandmarks([51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67],10)"); + Globals->abbreviations.insert("RectFromPBDEyes","RectFromLandmarks([9, 10, 11, 12, 13, 14, 20, 21, 22, 23, 24, 25],10,6.0)"); + Globals->abbreviations.insert("RectFromPBDNose","RectFromLandmarks([0, 1, 2, 3, 4, 5, 6, 7, 8],10)"); + Globals->abbreviations.insert("RectFromPBDBrow","RectFromLandmarks([15, 16, 17, 18, 19, 26, 27, 28, 29, 30],10)"); + Globals->abbreviations.insert("RectFromPBDMouth","RectFromLandmarks([31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],10)"); + Globals->abbreviations.insert("RectFromPBDJaw","RectFromLandmarks([51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67],10)"); } void finalize() const diff --git a/sdk/plugins/stasm.cpp b/sdk/plugins/stasm.cpp index 4a306ab..b0379fa 100644 --- a/sdk/plugins/stasm.cpp +++ b/sdk/plugins/stasm.cpp @@ -1,9 +1,43 @@ +#include + +#include + +#include + #include +using namespace cv; + namespace br { /*! + * \ingroup initializers + * \brief Initialize Stasm + * \author Scott Klum \cite sklum + */ +class StasmInitializer : public Initializer +{ + Q_OBJECT + + void initialize() const + { + Globals->abbreviations.insert("RectFromStasmEyes","RectFromLandmarks([27, 28, 29, 30, 31, 32, 33, 34, 35, 36],10)"); + Globals->abbreviations.insert("RectFromStasmJaw","RectFromLandmarks([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14],10)"); + Globals->abbreviations.insert("RectFromStasmBrow","RectFromLandmarks([15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26],10)"); + Globals->abbreviations.insert("RectFromStasmNose","RectFromLandmarks([37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47],10)"); + Globals->abbreviations.insert("RectFromStasmMouth","RectFromLandmarks([48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66],10)"); + } + + void finalize() const + { + + } +}; + +BR_REGISTER(Initializer, StasmInitializer) + +/*! * \ingroup transforms * \brief Wraps STASM key point detector * \author Scott Klum \cite sklum @@ -20,7 +54,19 @@ class StasmTransform : public UntrainableTransform void project(const Template &src, Template &dst) const { + int nlandmarks; + int landmarks[500]; + + AsmSearchDll(&nlandmarks, landmarks, + src.file.name.toStdString().c_str(), reinterpret_cast(src.m().data), src.m().cols, src.m().rows, + src.m(), (src.m().channels() == 3), NULL, NULL); + + if (nlandmarks == 0) qFatal("Unable to detect Stasm landmarks"); + + for (int i = 0; i < nlandmarks; i++) + dst.file.appendLandmark(QPointF(landmarks[2 * i], landmarks[2 * i + 1])); + dst.m() = src.m().clone(); } };