Commit 5c7fd6bfbbdd7bcbcd199332ffe80272fb1d2e76

Authored by jklontz
2 parents e0463ba6 88f7c64b

Merge pull request #18 from biometrics/rankOutput

Rank output
sdk/plugins/output.cpp
... ... @@ -259,6 +259,46 @@ BR_REGISTER(Output, EmptyOutput)
259 259  
260 260 /*!
261 261 * \ingroup outputs
  262 + * \brief Outputs highest ranked matches with scores.
  263 + * \author Scott Klum \cite sklum
  264 + */
  265 +class rankOutput : public MatrixOutput
  266 +{
  267 + Q_OBJECT
  268 +
  269 + ~rankOutput()
  270 + {
  271 + if (targetFiles.isEmpty() || queryFiles.isEmpty()) return;
  272 +
  273 + QList<int> ranks;
  274 + QList<double> scores;
  275 + QStringList lines;
  276 +
  277 + for (int i=0; i<queryFiles.size(); i++) {
  278 + typedef QPair<float,int> Pair;
  279 + int rank = 1;
  280 + foreach (const Pair &pair, Common::Sort(OpenCVUtils::matrixToVector(data.row(i)), true)) {
  281 + if(targetFiles[pair.second].label() == queryFiles[i].label()) {
  282 + ranks.append(rank);
  283 + scores.append(pair.first);
  284 + break;
  285 + }
  286 + rank++;
  287 + }
  288 + }
  289 +
  290 + typedef QPair<int,int> RankPair;
  291 + foreach (const RankPair &pair, Common::Sort(ranks, false))
  292 + lines.append(queryFiles[pair.second].name + " " + QString::number(pair.first) + " " + QString::number(scores[pair.second]) + " " + targetFiles[pair.second].name);
  293 +
  294 + QtUtils::writeFile(file, lines);
  295 + }
  296 +};
  297 +
  298 +BR_REGISTER(Output, rankOutput)
  299 +
  300 +/*!
  301 + * \ingroup outputs
262 302 * \brief The highest scoring matches.
263 303 * \author Josh Klontz \cite jklontz
264 304 */
... ...
sdk/plugins/pp5.cpp
... ... @@ -46,7 +46,7 @@ class PP5Initializer : public Initializer
46 46 void initialize() const
47 47 {
48 48 TRY(ppr_initialize_sdk(qPrintable(Globals->sdkPath + "/share/openbr/models/pp5/"), my_license_id, my_license_key))
49   - Globals->abbreviations.insert("PP5","Open+PP5Enroll!Identity:PP5Compare");
  49 + Globals->abbreviations.insert("PP5","Open!PP5Enroll:PP5Compare");
50 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)");
51 51 }
52 52  
... ...
sdk/plugins/stasm.cpp
... ... @@ -45,7 +45,7 @@ class StasmTransform : public UntrainableTransform
45 45  
46 46 AsmSearchDll(&nlandmarks, landmarks,
47 47 qPrintable(src.file.name), reinterpret_cast<char*>(src.m().data), src.m().cols, src.m().rows,
48   - src.m(), (src.m().channels() == 3), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/mu-68-1d.conf"), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/mu-76-2d.conf"));
  48 + src.m(), (src.m().channels() == 3), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/mu-68-1d.conf"), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/mu-76-2d.conf"), qPrintable(Globals->sdkPath + "/share/openbr/models/stasm/"));
49 49  
50 50 if (nlandmarks == 0) qWarning("Unable to detect Stasm landmarks");
51 51  
... ...
share/openbr/cmake/FindStasm.cmake
... ... @@ -10,7 +10,11 @@
10 10  
11 11 find_path(Stasm_DIR include/stasm.hpp ${CMAKE_SOURCE_DIR}/3rdparty/*)
12 12  
  13 +add_subdirectory(${Stasm_DIR} ${Stasm_DIR}/build)
  14 +
  15 +set(SRC ${SOURCE};${SRC})
  16 +
13 17 include_directories(${Stasm_DIR}/include)
14   -link_directories(${Stasm_DIR}/lib)
  18 +link_directories(${Stasm_DIR}/build)
15 19  
16 20 set(Stasm_LIBS stasm)
... ...