Commit 2463460dca6d4554ef7306032e150b0123ffd7e4

Authored by Scott Klum
1 parent c996e5ae

Local

sdk/core/core.cpp
... ... @@ -113,8 +113,9 @@ struct AlgorithmCore
113 113 QScopedPointer<Gallery> g(Gallery::make(gallery));
114 114 if (g.isNull()) return FileList();
115 115  
116   - if (gallery.contains("read") || gallery.contains("cache"))
  116 + if (gallery.contains("read") || gallery.contains("cache")) {
117 117 fileList = g->files();
  118 + }
118 119 if (!fileList.isEmpty() && gallery.contains("cache"))
119 120 return fileList;
120 121  
... ...
sdk/plugins/filter.cpp
... ... @@ -155,7 +155,6 @@ class CSDNTransform : public UntrainableTransform
155 155 }
156 156 }
157 157  
158   - m.convertTo(m, CV_8UC1);
159 158 dst = m;
160 159  
161 160 }
... ... @@ -214,6 +213,7 @@ class ContrastEqTransform : public UntrainableTransform
214 213 for (int i=0; i<nRows; i++)
215 214 for (int j=0; j<nCols; j++)
216 215 m.at<float>(i, j) = fast_tanh(p[i*nCols+j]);
  216 +
217 217 dst = m;
218 218 }
219 219 };
... ...
sdk/plugins/output.cpp
... ... @@ -170,6 +170,7 @@ class rrOutput : public MatrixOutput
170 170 const float threshold = file.getFloat("threshold", -std::numeric_limits<float>::max());
171 171  
172 172 QStringList lines;
  173 +
173 174 for (int i=0; i<queryFiles.size(); i++) {
174 175 QStringList files;
175 176 if (!byLine) files.append(queryFiles[i]);
... ... @@ -181,7 +182,6 @@ class rrOutput : public MatrixOutput
181 182 target.set("Score", QString::number(pair.first));
182 183 files.append(target.flat());
183 184 }
184   -
185 185 lines.append(files.join(byLine ? "\n" : ","));
186 186 }
187 187  
... ...
sdk/plugins/pp5.cpp
... ... @@ -47,7 +47,7 @@ class PP5Initializer : public Initializer
47 47 {
48 48 TRY(ppr_initialize_sdk(qPrintable(Globals->sdkPath + "/share/openbr/models/pp5/"), my_license_id, my_license_key))
49 49 Globals->abbreviations.insert("PP5","Open!PP5Enroll:PP5Compare");
50   - Globals->abbreviations.insert("RegisterFace", "Open+Cvt(Gray)+PP5Enroll(true)+Rename(PP5_Landmark0_Right_Eye_X,Affine_0_X)+Rename(PP5_Landmark0_Right_Eye_Y,Affine_0_Y)+Rename(PP5_Landmark1_Left_Eye_X,Affine_1_X)+Rename(PP5_Landmark1_Left_Eye_Y,Affine_1_Y)+Affine(96,128,0.28,0.45)");
  50 + Globals->abbreviations.insert("PP5Register", "Open+PP5Enroll(true)+RenameFirst([eyeLx,PP5_Landmark0_Right_Eye_X],Affine_0_X)+RenameFirst([eyeLy,PP5_Landmark0_Right_Eye_Y],Affine_0_Y)+RenameFirst([eyeRx,PP5_Landmark1_Left_Eye_X],Affine_1_X)+RenameFirst([eyeRy,PP5_Landmark1_Left_Eye_Y],Affine_1_Y)");
51 51 }
52 52  
53 53 void finalize() const
... ...
sdk/plugins/regions.cpp
... ... @@ -148,7 +148,11 @@ class RectFromLandmarksTransform : public UntrainableTransform
148 148  
149 149 void project(const Template &src, Template &dst) const
150 150 {
151   - if (src.file.landmarks().isEmpty()) qFatal("No landmarks");
  151 + if (src.file.landmarks().isEmpty()) {
  152 + qWarning("No landmarks");
  153 + dst = src;
  154 + return;
  155 + }
152 156  
153 157 int minX, minY;
154 158 minX = minY = std::numeric_limits<int>::max();
... ... @@ -156,7 +160,7 @@ class RectFromLandmarksTransform : public UntrainableTransform
156 160 maxX = maxY = -std::numeric_limits<int>::max();
157 161  
158 162 foreach(int index, indices) {
159   - if (src.file.landmarks().size() < index+1) {
  163 + if (src.file.landmarks().size() > index+1) {
160 164 if (src.file.landmarks()[index].x() < minX) minX = src.file.landmarks()[index].x();
161 165 if (src.file.landmarks()[index].x() > maxX) maxX = src.file.landmarks()[index].x();
162 166 if (src.file.landmarks()[index].y() < minY) minY = src.file.landmarks()[index].y();
... ... @@ -165,11 +169,16 @@ class RectFromLandmarksTransform : public UntrainableTransform
165 169 }
166 170 }
167 171  
168   - double width = maxX-minX+padding;
169   - double height = maxY-minY+padding;
170   - //double deltaHeight = ((width/aspectRatio) - height);
  172 + // Padding is .05
  173 + double width = maxX-minX;
  174 + double deltaWidth = width*padding;
  175 + width += deltaWidth;
  176 +
  177 + double height = maxY-minY;
  178 + double deltaHeight = width/aspectRatio - height;
  179 + height += deltaHeight;
171 180  
172   - dst.m() = src.m()(Rect(std::max(0.0, minX-padding/2.0), std::max(0.0, minY-padding/2.0), width, height));
  181 + dst.m() = src.m()(Rect(std::max(0.0, minX - deltaWidth/2.0), std::max(0.0, minY - deltaHeight/2.0), std::min((double)src.m().cols, width), std::min((double)src.m().rows, height)));
173 182 }
174 183 };
175 184  
... ...
sdk/plugins/stasm.cmake
... ... @@ -6,9 +6,9 @@ if(${BR_WITH_STASM})
6 6 set(BR_THIRDPARTY_LIBS ${BR_THIRDPARTY_LIBS} ${Stasm_LIBS})
7 7  
8 8 if(WIN32)
9   - install(DIRECTORY ${Stasm_DIR}/lib/ DESTINATION bin)
  9 + install(DIRECTORY ${Stasm_DIR}/build/ DESTINATION bin)
10 10 else()
11   - install(DIRECTORY ${Stasm_DIR}/lib/ DESTINATION lib)
  11 + install(DIRECTORY ${Stasm_DIR}/build/ DESTINATION lib)
12 12 endif()
13 13  
14 14 install(DIRECTORY ${Stasm_DIR}/models/ DESTINATION share/openbr/models/stasm)
... ...
sdk/plugins/stasm.cpp
... ... @@ -18,11 +18,11 @@ class StasmInitializer : public Initializer
18 18  
19 19 void initialize() const
20 20 {
21   - Globals->abbreviations.insert("RectFromStasmEyes","RectFromLandmarks([27, 28, 29, 30, 31, 32, 33, 34, 35, 36],10)");
  21 + Globals->abbreviations.insert("RectFromStasmEyes","RectFromLandmarks([27, 28, 29, 30, 31, 32, 33, 34, 35, 36],0.125,6.0)+Resize(44,168)"); //
22 22 Globals->abbreviations.insert("RectFromStasmJaw","RectFromLandmarks([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14],10)");
23   - Globals->abbreviations.insert("RectFromStasmBrow","RectFromLandmarks([15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26],10)");
24   - Globals->abbreviations.insert("RectFromStasmNose","RectFromLandmarks([37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47],10)");
25   - 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)");
  23 + Globals->abbreviations.insert("RectFromStasmBrow","RectFromLandmarks([15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26],0.05,6.5)+Resize(44,230)");
  24 + Globals->abbreviations.insert("RectFromStasmNose","RectFromLandmarks([37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47],0.05,1.25)");
  25 + Globals->abbreviations.insert("RectFromStasmMouth","RectFromLandmarks([48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66],0.15,3.0)+Resize(44,110)");
26 26 }
27 27 };
28 28  
... ... @@ -38,6 +38,11 @@ class StasmTransform : public UntrainableTransform
38 38 {
39 39 Q_OBJECT
40 40  
  41 + void init()
  42 + {
  43 + Globals->setProperty("parallelism", "0"); // Can only work in single threaded mode
  44 + }
  45 +
41 46 void project(const Template &src, Template &dst) const
42 47 {
43 48 int nlandmarks;
... ... @@ -50,6 +55,7 @@ class StasmTransform : public UntrainableTransform
50 55 if (nlandmarks == 0) qWarning("Unable to detect Stasm landmarks");
51 56  
52 57 dst = src;
  58 +
53 59 for (int i = 0; i < nlandmarks; i++)
54 60 dst.file.appendLandmark(QPointF(landmarks[2 * i], landmarks[2 * i + 1]));
55 61 }
... ...