Commit 52951bae5570fd89affe879b5c09742d85b17b2a

Authored by Josh Klontz
2 parents 4c3ee28f f9adb23c

Merge branch 'master' of https://github.com/biometrics/openbr

Showing 1 changed file with 10 additions and 1 deletions
openbr/plugins/stasm4.cpp
... ... @@ -54,6 +54,9 @@ class StasmTransform : public UntrainableTransform
54 54 {
55 55 Q_OBJECT
56 56  
  57 + Q_PROPERTY(bool stasm3Format READ get_stasm3Format WRITE set_stasm3Format RESET reset_stasm3Format STORED false)
  58 + BR_PROPERTY(bool, stasm3Format, false)
  59 +
57 60 Resource<StasmCascadeClassifier> stasmCascadeResource;
58 61  
59 62 void init()
... ... @@ -69,14 +72,20 @@ class StasmTransform : public UntrainableTransform
69 72 StasmCascadeClassifier *stasmCascade = stasmCascadeResource.acquire();
70 73  
71 74 int foundface;
  75 + int nLandmarks = stasm_NLANDMARKS;
72 76 float landmarks[2 * stasm_NLANDMARKS];
73 77 stasm_search_single(&foundface, landmarks, reinterpret_cast<const char*>(src.m().data), src.m().cols, src.m().rows, *stasmCascade, NULL, NULL);
74 78  
  79 + if (stasm3Format) {
  80 + nLandmarks = 76;
  81 + stasm_convert_shape(landmarks, nLandmarks);
  82 + }
  83 +
75 84 stasmCascadeResource.release(stasmCascade);
76 85  
77 86 if (!foundface) qWarning("No face found in %s", qPrintable(src.file.fileName()));
78 87 else {
79   - for (int i = 0; i < stasm_NLANDMARKS; i++)
  88 + for (int i = 0; i < nLandmarks; i++)
80 89 dst.file.appendPoint(QPointF(landmarks[2 * i], landmarks[2 * i + 1]));
81 90 }
82 91  
... ...