Commit cd5b442dbc93b7e0501bb60daab587fedbc6bfed
Merge branch 'master' of https://github.com/biometrics/openbr
Showing
9 changed files
with
2 additions
and
201 deletions
3rdparty/stasm4.0.0/stasm/hatdesc.cpp
| @@ -9,16 +9,6 @@ | @@ -9,16 +9,6 @@ | ||
| 9 | 9 | ||
| 10 | #define CACHE 1 // define to 0 if your compiler doesn't support hash_map | 10 | #define CACHE 1 // define to 0 if your compiler doesn't support hash_map |
| 11 | // Stasm runs faster if 1 | 11 | // Stasm runs faster if 1 |
| 12 | -#if CACHE | ||
| 13 | - // define hash_map, current implementations are compiler dependent (2013) | ||
| 14 | - #ifdef _MSC_VER // microsoft | ||
| 15 | - #include <hash_map> | ||
| 16 | - using namespace stdext; | ||
| 17 | - #else // assume gcc | ||
| 18 | - #include <ext/hash_map> | ||
| 19 | - using namespace __gnu_cxx; | ||
| 20 | - #endif | ||
| 21 | -#endif | ||
| 22 | 12 | ||
| 23 | namespace stasm | 13 | namespace stasm |
| 24 | { | 14 | { |
3rdparty/stasm4.0.0/stasm/stasm.cpp deleted
openbr/plugins/pbd.cmake deleted
| 1 | -set(BR_WITH_PBD OFF CACHE BOOL "Build with PartsBasedDetector") | ||
| 2 | - | ||
| 3 | -if(${BR_WITH_PBD}) | ||
| 4 | - find_package(PBD REQUIRED) | ||
| 5 | - set(BR_THIRDPARTY_SRC ${BR_THIRDPARTY_SRC} plugins/pbd.cpp) | ||
| 6 | - set(BR_THIRDPARTY_LIBS ${BR_THIRDPARTY_LIBS} ${PBD_LIBS}) | ||
| 7 | - | ||
| 8 | - if(WIN32) | ||
| 9 | - install(DIRECTORY ${PBD_DIR}/lib/ DESTINATION bin) | ||
| 10 | - else() | ||
| 11 | - install(DIRECTORY ${PBD_DIR}/lib/ DESTINATION lib) | ||
| 12 | - endif() | ||
| 13 | - | ||
| 14 | - install(DIRECTORY ${PBD_DIR}/models/ DESTINATION share/openbr/models/pbd) | ||
| 15 | -endif() |
openbr/plugins/pbd.cpp deleted
| 1 | -#include <QFileInfo> | ||
| 2 | - | ||
| 3 | -#include <opencv2/highgui/highgui.hpp> | ||
| 4 | - | ||
| 5 | -#include "openbr_internal.h" | ||
| 6 | - | ||
| 7 | -#include "core/opencvutils.h" | ||
| 8 | - | ||
| 9 | -#include <boost/scoped_ptr.hpp> | ||
| 10 | -#include <boost/filesystem.hpp> | ||
| 11 | - | ||
| 12 | -#include "PartsBasedDetector.hpp" | ||
| 13 | -#include "Candidate.hpp" | ||
| 14 | -#include "FileStorageModel.hpp" | ||
| 15 | -#include "Visualize.hpp" | ||
| 16 | -#include "types.hpp" | ||
| 17 | -#include "nms.hpp" | ||
| 18 | -#include "Rect3.hpp" | ||
| 19 | -#include "DistanceTransform.hpp" | ||
| 20 | - | ||
| 21 | -using namespace cv; | ||
| 22 | - | ||
| 23 | -namespace br | ||
| 24 | -{ | ||
| 25 | - | ||
| 26 | -/*! | ||
| 27 | - * \ingroup initializers | ||
| 28 | - * \brief Initialize PBD | ||
| 29 | - * \author Scott Klum \cite sklum | ||
| 30 | - */ | ||
| 31 | -class PBDInitializer : public Initializer | ||
| 32 | -{ | ||
| 33 | - Q_OBJECT | ||
| 34 | - | ||
| 35 | - void initialize() const | ||
| 36 | - { | ||
| 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 | - } | ||
| 43 | - | ||
| 44 | - void finalize() const | ||
| 45 | - { | ||
| 46 | - | ||
| 47 | - } | ||
| 48 | -}; | ||
| 49 | - | ||
| 50 | -BR_REGISTER(Initializer, PBDInitializer) | ||
| 51 | - | ||
| 52 | -/*! | ||
| 53 | - * \ingroup transforms | ||
| 54 | - * \brief Wraps Parts Based Detector | ||
| 55 | - * \author Scott Klum \cite sklum | ||
| 56 | - * \note Some of the detected landmarks overlap | ||
| 57 | - * \todo Remove print statements from pdb src, remove Boost dependency | ||
| 58 | - */ | ||
| 59 | - | ||
| 60 | -class PBDTransform : public UntrainableTransform | ||
| 61 | -{ | ||
| 62 | - Q_OBJECT | ||
| 63 | - | ||
| 64 | - Q_PROPERTY(QString modelPath READ get_modelPath WRITE set_modelPath RESET reset_modelPath STORED false) | ||
| 65 | - BR_PROPERTY(QString, modelPath, "") | ||
| 66 | - | ||
| 67 | - boost::scoped_ptr<Model> model; | ||
| 68 | - | ||
| 69 | - void init() | ||
| 70 | - { | ||
| 71 | - if (modelPath.isEmpty()) qFatal("No model file"); | ||
| 72 | - | ||
| 73 | - model.reset(new FileStorageModel); | ||
| 74 | - | ||
| 75 | - QFileInfo info(modelPath); | ||
| 76 | - | ||
| 77 | - if (info.suffix().compare("xml") == 0 || info.suffix().compare("yaml") == 0) model.reset(new FileStorageModel); | ||
| 78 | - else qFatal("Unsupported model format: %s", qPrintable(info.suffix())); | ||
| 79 | - | ||
| 80 | - if (!(model->deserialize(info.filePath().toStdString()))) qFatal("Error deserializing model, check file path"); | ||
| 81 | - } | ||
| 82 | - | ||
| 83 | - void project(const Template &src, Template &dst) const | ||
| 84 | - { | ||
| 85 | - dst = src.m().clone(); | ||
| 86 | - | ||
| 87 | - PartsBasedDetector<float> pbd; | ||
| 88 | - pbd.distributeModel(*model); | ||
| 89 | - | ||
| 90 | - Mat_<float> depth; | ||
| 91 | - | ||
| 92 | - // Detect potential candidates in the image | ||
| 93 | - vector<Candidate> candidates; | ||
| 94 | - pbd.detect(src.m(), depth, candidates); | ||
| 95 | - | ||
| 96 | - if (Globals->verbose) qDebug("%li candidate detected for %s", candidates.size(), qPrintable(src.file.flat())); | ||
| 97 | - | ||
| 98 | - // Sort the candidates by score, then supress all but the candidate with the maximum score | ||
| 99 | - if (candidates.size() > 0) { | ||
| 100 | - Candidate::sort(candidates); | ||
| 101 | - Candidate::nonMaximaSuppression(src.m(), candidates, 0.2); | ||
| 102 | - foreach ( const cv::Rect part, candidates[0].parts() ) | ||
| 103 | - dst.file.appendLandmark(QPointF(part.x + part.width/2.0, part.y + part.height/2.0)); | ||
| 104 | - } | ||
| 105 | - } | ||
| 106 | -}; | ||
| 107 | - | ||
| 108 | -BR_REGISTER(Transform, PBDTransform) | ||
| 109 | - | ||
| 110 | -} // namespace br | ||
| 111 | - | ||
| 112 | -#include "pbd.moc" | ||
| 113 | - |
openbr/plugins/stasm3.cmake deleted
| 1 | -set(BR_WITH_STASM3 OFF CACHE BOOL "Build with Stasm") | ||
| 2 | - | ||
| 3 | -if(${BR_WITH_STASM3}) | ||
| 4 | - find_package(Stasm3 REQUIRED) | ||
| 5 | - set(BR_THIRDPARTY_SRC ${BR_THIRDPARTY_SRC} plugins/stasm3.cpp) | ||
| 6 | - set(BR_THIRDPARTY_LIBS ${BR_THIRDPARTY_LIBS} ${Stasm3_LIBS}) | ||
| 7 | - | ||
| 8 | - if(WIN32) | ||
| 9 | - install(DIRECTORY ${Stasm_DIR}/build/ DESTINATION bin) | ||
| 10 | - else() | ||
| 11 | - install(DIRECTORY ${Stasm_DIR}/build/ DESTINATION lib) | ||
| 12 | - endif() | ||
| 13 | - | ||
| 14 | - install(DIRECTORY ${Stasm_DIR}/models/ DESTINATION share/openbr/models/stasm) | ||
| 15 | -endif() |
openbr/plugins/stasm4.cmake
openbr/plugins/validate.cpp
| @@ -275,8 +275,7 @@ class RejectDistance : public Distance | @@ -275,8 +275,7 @@ class RejectDistance : public Distance | ||
| 275 | (void) b; | 275 | (void) b; |
| 276 | 276 | ||
| 277 | foreach (const QString &key, keys) | 277 | foreach (const QString &key, keys) |
| 278 | - if ((rejectIfContains && a.file.contains(key)) || | ||
| 279 | - (!rejectIfContains && !a.file.contains(key))) | 278 | + if ((rejectIfContains && a.file.contains(key)) || (!rejectIfContains && !a.file.contains(key))) |
| 280 | return -std::numeric_limits<float>::max(); | 279 | return -std::numeric_limits<float>::max(); |
| 281 | 280 | ||
| 282 | return 0; | 281 | return 0; |
share/openbr/cmake/FindPBD.cmake deleted
| 1 | -# ================================================================ | ||
| 2 | -# The PartsBasedDetector CMake configuration file | ||
| 3 | -# | ||
| 4 | -# Usage from an external project: | ||
| 5 | -# In your CMakeLists.txt, add these lines: | ||
| 6 | -# | ||
| 7 | -# find_package(PBD REQUIRED) | ||
| 8 | -# target_link_libraries(MY_TARGET ${PBD_LIBS}) | ||
| 9 | -# ================================================================ | ||
| 10 | - | ||
| 11 | -find_path(PBD_DIR include/Candidate.hpp ${CMAKE_SOURCE_DIR}/3rdparty/*) | ||
| 12 | -include_directories(${PBD_DIR}/include) | ||
| 13 | -link_directories(${PBD_DIR}/lib) | ||
| 14 | - | ||
| 15 | -find_package(Boost COMPONENTS system serialization REQUIRED) | ||
| 16 | -include_directories(${Boost_INCLUDE_DIR}) | ||
| 17 | -link_directories(${Boost_LIBRARY_DIRS}) | ||
| 18 | -set(BR_THIRDPARTY_LIBS ${BR_THIRDPARTY_LIBS} ${Boost_LIBRARIES}) | ||
| 19 | - | ||
| 20 | -set(PBD_LIBS PartsBasedDetector) |
share/openbr/cmake/FindStasm3.cmake deleted
| 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(Stasm3 REQUIRED) | ||
| 8 | -# target_link_libraries(MY_TARGET ${Stasm4_LIBS}) | ||
| 9 | -# ================================================================ | ||
| 10 | - | ||
| 11 | -find_path(Stasm_DIR include/stasm.hpp ${CMAKE_SOURCE_DIR}/3rdparty/*) | ||
| 12 | - | ||
| 13 | -add_subdirectory(${Stasm_DIR} ${Stasm_DIR}/build) | ||
| 14 | - | ||
| 15 | -set(SRC ${SOURCE};${SRC}) | ||
| 16 | - | ||
| 17 | -include_directories(${Stasm_DIR}/include) | ||
| 18 | -link_directories(${Stasm_DIR}/build) | ||
| 19 | - | ||
| 20 | -set(Stasm3_LIBS stasm) |