Commit c76a7c172491cc8b4bbcc30413eb7c4b08d3a276

Authored by Josh Klontz
2 parents 3118053b 4665a761

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

sdk/plugins/nec3.cmake
1   -set(BR_WITH_NEC3 OFF CACHE BOOL "Build with NEC NeoFaceDSK 3")
  1 +set(BR_WITH_NEC3 OFF CACHE BOOL "Build with NEC NeoFaceSDK 3")
2 2  
3 3 if(${BR_WITH_NEC3})
4 4 find_package(NEC3 REQUIRED)
... ...
sdk/plugins/pbd.cpp
... ... @@ -34,11 +34,11 @@ class PBDInitializer : public Initializer
34 34  
35 35 void initialize() const
36 36 {
37   - Globals->abbreviations.insert("RectFromEyes","RectFromLandmarks([9, 10, 11, 12, 13, 14, 20, 21, 22, 23, 24, 25],10,6.0)");
38   - Globals->abbreviations.insert("RectFromNose","RectFromLandmarks([0, 1, 2, 3, 4, 5, 6, 7, 8],10)");
39   - Globals->abbreviations.insert("RectFromBrow","RectFromLandmarks([15, 16, 17, 18, 19, 26, 27, 28, 29, 30],10)");
40   - 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)");
41   - Globals->abbreviations.insert("RectFromJaw","RectFromLandmarks([51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67],10)");
  37 + Globals->abbreviations.insert("RectFromPBDEyes","RectFromLandmarks([9, 10, 11, 12, 13, 14, 20, 21, 22, 23, 24, 25],10,6.0)");
  38 + Globals->abbreviations.insert("RectFromPBDNose","RectFromLandmarks([0, 1, 2, 3, 4, 5, 6, 7, 8],10)");
  39 + Globals->abbreviations.insert("RectFromPBDBrow","RectFromLandmarks([15, 16, 17, 18, 19, 26, 27, 28, 29, 30],10)");
  40 + 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)");
  41 + Globals->abbreviations.insert("RectFromPBDJaw","RectFromLandmarks([51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67],10)");
42 42 }
43 43  
44 44 void finalize() const
... ...
sdk/plugins/regions.cpp
... ... @@ -156,11 +156,13 @@ class RectFromLandmarksTransform : public UntrainableTransform
156 156 maxX = maxY = -std::numeric_limits<int>::max();
157 157  
158 158 foreach(int index, indices) {
159   - if (src.file.landmarks()[index].x() < minX) minX = src.file.landmarks()[index].x();
160   - if (src.file.landmarks()[index].x() > maxX) maxX = src.file.landmarks()[index].x();
161   - if (src.file.landmarks()[index].y() < minY) minY = src.file.landmarks()[index].y();
162   - if (src.file.landmarks()[index].y() > maxY) maxY = src.file.landmarks()[index].y();
163   - dst.file.appendLandmark(src.file.landmarks()[index]);
  159 + if (src.file.landmarks().size() < index+1) {
  160 + if (src.file.landmarks()[index].x() < minX) minX = src.file.landmarks()[index].x();
  161 + if (src.file.landmarks()[index].x() > maxX) maxX = src.file.landmarks()[index].x();
  162 + if (src.file.landmarks()[index].y() < minY) minY = src.file.landmarks()[index].y();
  163 + if (src.file.landmarks()[index].y() > maxY) maxY = src.file.landmarks()[index].y();
  164 + dst.file.appendLandmark(src.file.landmarks()[index]);
  165 + }
164 166 }
165 167  
166 168 double width = maxX-minX+padding;
... ...
sdk/plugins/stasm.cmake 0 โ†’ 100644
  1 +set(BR_WITH_STASM OFF CACHE BOOL "Build with Stasm")
  2 +
  3 +if(${BR_WITH_STASM})
  4 + find_package(Stasm REQUIRED)
  5 + set(BR_THIRDPARTY_SRC ${BR_THIRDPARTY_SRC} plugins/stasm.cpp)
  6 + set(BR_THIRDPARTY_LIBS ${BR_THIRDPARTY_LIBS} ${Stasm_LIBS})
  7 +
  8 + if(WIN32)
  9 + install(DIRECTORY ${Stasm_DIR}/lib/ DESTINATION bin)
  10 + else()
  11 + install(DIRECTORY ${Stasm_DIR}/lib/ DESTINATION lib)
  12 + endif()
  13 +
  14 + install(DIRECTORY ${Stasm_DIR}/models/ DESTINATION share/openbr/models/stasm)
  15 +endif()
... ...
sdk/plugins/stasm.cpp 0 โ†’ 100644
  1 +#include <stasm_dll.hpp>
  2 +#include <opencv2/highgui/highgui.hpp>
  3 +#include <openbr_plugin.h>
  4 +
  5 +using namespace cv;
  6 +
  7 +namespace br
  8 +{
  9 +
  10 +/*!
  11 + * \ingroup initializers
  12 + * \brief Initialize Stasm
  13 + * \author Scott Klum \cite sklum
  14 + */
  15 +class StasmInitializer : public Initializer
  16 +{
  17 + Q_OBJECT
  18 +
  19 + void initialize() const
  20 + {
  21 + Globals->abbreviations.insert("RectFromStasmEyes","RectFromLandmarks([27, 28, 29, 30, 31, 32, 33, 34, 35, 36],10)");
  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)");
  26 + }
  27 +};
  28 +
  29 +BR_REGISTER(Initializer, StasmInitializer)
  30 +
  31 +/*!
  32 + * \ingroup transforms
  33 + * \brief Wraps STASM key point detector
  34 + * \author Scott Klum \cite sklum
  35 + */
  36 +
  37 +class StasmTransform : public UntrainableTransform
  38 +{
  39 + Q_OBJECT
  40 +
  41 + void project(const Template &src, Template &dst) const
  42 + {
  43 + int nlandmarks;
  44 + int landmarks[500];
  45 +
  46 + AsmSearchDll(&nlandmarks, landmarks,
  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"));
  49 +
  50 + if (nlandmarks == 0) qWarning("Unable to detect Stasm landmarks");
  51 +
  52 + dst = src;
  53 + for (int i = 0; i < nlandmarks; i++)
  54 + dst.file.appendLandmark(QPointF(landmarks[2 * i], landmarks[2 * i + 1]));
  55 + }
  56 +};
  57 +
  58 +BR_REGISTER(Transform, StasmTransform)
  59 +
  60 +} // namespace br
  61 +
  62 +#include "stasm.moc"
... ...
share/openbr/cmake/FindPBD.cmake
... ... @@ -13,8 +13,6 @@ include_directories(${PBD_DIR}/include)
13 13 link_directories(${PBD_DIR}/lib)
14 14  
15 15 find_package(Boost COMPONENTS system serialization REQUIRED)
16   -message(${Boost_INCLUDE_DIR})
17   -message(${Boost_LIBRARIES})
18 16 include_directories(${Boost_INCLUDE_DIR})
19 17 link_directories(${Boost_LIBRARY_DIRS})
20 18 set(BR_THIRDPARTY_LIBS ${BR_THIRDPARTY_LIBS} ${Boost_LIBRARIES})
... ...
share/openbr/cmake/FindStasm.cmake 0 โ†’ 100644
  1 +# ================================================================
  2 +# The Stasm CMake configuration file
  3 +#
  4 +# Usage from an external project:
  5 +# In your CMakeLists.txt, add these lines:
  6 +#
  7 +# find_package(Stasm REQUIRED)
  8 +# target_link_libraries(MY_TARGET ${Stasm_LIBS})
  9 +# ================================================================
  10 +
  11 +find_path(Stasm_DIR include/stasm.hpp ${CMAKE_SOURCE_DIR}/3rdparty/*)
  12 +
  13 +include_directories(${Stasm_DIR}/include)
  14 +link_directories(${Stasm_DIR}/lib)
  15 +
  16 +set(Stasm_LIBS stasm)
... ...