Commit 32cd95b3a67712ff78b3ab0ebe4352deedab733a
1 parent
e0b47ea8
Removed old stasm file
Showing
1 changed file
with
0 additions
and
94 deletions
openbr/plugins/stasm.cpp deleted
| 1 | -#include <stasm_dll.hpp> | ||
| 2 | -#include <stasm.hpp> | ||
| 3 | -#include <opencv2/highgui/highgui.hpp> | ||
| 4 | -#include "openbr_internal.h" | ||
| 5 | - | ||
| 6 | -using namespace cv; | ||
| 7 | - | ||
| 8 | -namespace br | ||
| 9 | -{ | ||
| 10 | - | ||
| 11 | -/*! | ||
| 12 | - * \ingroup initializers | ||
| 13 | - * \brief Initialize Stasm | ||
| 14 | - * \author Scott Klum \cite sklum | ||
| 15 | - */ | ||
| 16 | -class StasmInitializer : public Initializer | ||
| 17 | -{ | ||
| 18 | - Q_OBJECT | ||
| 19 | - | ||
| 20 | - void initialize() const | ||
| 21 | - { | ||
| 22 | - Globals->abbreviations.insert("RectFromStasmEyes","RectFromPoints([27, 28, 29, 30, 31, 32, 33, 34, 35, 36],0.125,6.0)+Resize(44,164)"); | ||
| 23 | - Globals->abbreviations.insert("RectFromStasmJaw","RectFromPoints([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14],10)"); | ||
| 24 | - Globals->abbreviations.insert("RectFromStasmBrow","RectFromPoints([15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26],0.15,6)+Resize(28,132)"); | ||
| 25 | - Globals->abbreviations.insert("RectFromStasmNose","RectFromPoints([38, 39, 40, 41, 42, 43, 44, 67],0.15,1.25)+Resize(44,44)"); | ||
| 26 | - Globals->abbreviations.insert("RectFromStasmMouth","RectFromPoints([48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66],0.3,3.0)+Resize(28,68)"); | ||
| 27 | - } | ||
| 28 | -}; | ||
| 29 | - | ||
| 30 | -BR_REGISTER(Initializer, StasmInitializer) | ||
| 31 | - | ||
| 32 | -/*! | ||
| 33 | - * \ingroup transforms | ||
| 34 | - * \brief Wraps STASM key point detector | ||
| 35 | - * \author Scott Klum \cite sklum | ||
| 36 | - */ | ||
| 37 | -class StasmTransform : public UntrainableTransform | ||
| 38 | -{ | ||
| 39 | - Q_OBJECT | ||
| 40 | - | ||
| 41 | - QList<ASM_MODEL> models; | ||
| 42 | - //mutable QMutex mutex; | ||
| 43 | - | ||
| 44 | - void init() | ||
| 45 | - { | ||
| 46 | - models = nInitAsmModels(qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/mu-68-1d.conf"), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/mu-76-2d.conf")); | ||
| 47 | - } | ||
| 48 | - | ||
| 49 | - void project(const Template &src, Template &dst) const | ||
| 50 | - { | ||
| 51 | - //QMutexLocker locker(&mutex); | ||
| 52 | - | ||
| 53 | - //qDebug() << "PittPatt X: " << src.file.get<QPoint>("Affine_0").x() - src.m().cols/2 << src.file.get<QPoint>("Affine_1").x() - src.m().cols/2; | ||
| 54 | - //qDebug() << "PittPatt Y: " << src.m().rows/2 - src.file.get<QPoint>("Affine_0").y() << src.m().rows/2 - src.file.get<QPoint>("Affine_1").y(); | ||
| 55 | - | ||
| 56 | - int numLandmarks; | ||
| 57 | - int landmarks[500]; | ||
| 58 | - | ||
| 59 | - DET_PARAMS parameters; | ||
| 60 | - | ||
| 61 | - if (src.file.contains("Affine_0") && src.file.contains("Affine_1")) { | ||
| 62 | - parameters.lex = src.file.get<QPoint>("Affine_0").x() - src.m().cols/2; | ||
| 63 | - parameters.ley = src.m().rows/2 - src.file.get<QPoint>("Affine_0").y(); | ||
| 64 | - parameters.rex = src.file.get<QPoint>("Affine_1").x() - src.m().cols/2; | ||
| 65 | - parameters.rey = src.m().rows/2 - src.file.get<QPoint>("Affine_1").y(); | ||
| 66 | - } else { | ||
| 67 | - parameters.lex = parameters.ley = parameters.rex = parameters.rey = INVALID; | ||
| 68 | - } | ||
| 69 | - | ||
| 70 | - AsmSearchDll(numLandmarks, landmarks, qPrintable(src.file.name), | ||
| 71 | - reinterpret_cast<char*>(src.m().data), src.m(), models, | ||
| 72 | - qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/"), | ||
| 73 | - parameters); | ||
| 74 | - | ||
| 75 | - if (numLandmarks == 0) { | ||
| 76 | - qWarning("Unable to detect Stasm landmarks for %s", qPrintable(src.file.fileName())); | ||
| 77 | - dst.file.set("FTE", true); | ||
| 78 | - dst.m() = src.m(); | ||
| 79 | - return; | ||
| 80 | - } | ||
| 81 | - | ||
| 82 | - for (int i = 0; i < numLandmarks; i++) { | ||
| 83 | - dst.file.appendPoint(QPointF(landmarks[2 * i], landmarks[2 * i + 1])); | ||
| 84 | - } | ||
| 85 | - | ||
| 86 | - dst.m() = src.m(); | ||
| 87 | - } | ||
| 88 | -}; | ||
| 89 | - | ||
| 90 | -BR_REGISTER(Transform, StasmTransform) | ||
| 91 | - | ||
| 92 | -} // namespace br | ||
| 93 | - | ||
| 94 | -#include "stasm.moc" |