Commit 4ecb4d64ae5f3499e8d99fc91df2e999cab53b67
1 parent
a2b90fc4
updated examples, finished #12
Showing
11 changed files
with
160 additions
and
28 deletions
CMakeLists.txt
| ... | ... | @@ -6,8 +6,8 @@ set(BR_SHARE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/share/openbr") |
| 6 | 6 | set(CMAKE_AUTOMOC ON) |
| 7 | 7 | set(CMAKE_INCLUDE_CURRENT_DIR ON) |
| 8 | 8 | set(CPACK_PACKAGE_NAME "OpenBR") |
| 9 | -set(CPACK_PACKAGE_VENDOR "Open Biometric Recognition") | |
| 10 | -set(CPACK_PACKAGE_DESCRIPTION "Open Source Biometric Recognition and Evaluation") | |
| 9 | +set(CPACK_PACKAGE_VENDOR "OpenBR") | |
| 10 | +set(CPACK_PACKAGE_DESCRIPTION "Open Source Biometric Recognition") | |
| 11 | 11 | set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME}) |
| 12 | 12 | set(CPACK_PACKAGE_VERSION_MAJOR 0) |
| 13 | 13 | set(CPACK_PACKAGE_VERSION_MINOR 2) | ... | ... |
app/br/br.cpp
| ... | ... | @@ -31,8 +31,10 @@ |
| 31 | 31 | * \endcode |
| 32 | 32 | * |
| 33 | 33 | * \section cli_examples Examples |
| 34 | - * - \ref cli_compare_faces | |
| 35 | - * - \ref cli_evaluate_face_recognition | |
| 34 | + * - \ref cli_age_estimation | |
| 35 | + * - \ref cli_face_recognition | |
| 36 | + * - \ref cli_face_recognition_evaluation | |
| 37 | + * - \ref cli_gender_estimation | |
| 36 | 38 | */ |
| 37 | 39 | |
| 38 | 40 | static void help() | ... | ... |
app/examples/age_estimation.cpp
0 → 100644
| 1 | +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
| 2 | + * Copyright 2012 The MITRE Corporation * | |
| 3 | + * * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); * | |
| 5 | + * you may not use this file except in compliance with the License. * | |
| 6 | + * You may obtain a copy of the License at * | |
| 7 | + * * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 * | |
| 9 | + * * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software * | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, * | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * | |
| 13 | + * See the License for the specific language governing permissions and * | |
| 14 | + * limitations under the License. * | |
| 15 | + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
| 16 | + | |
| 17 | +/*! | |
| 18 | + * \ingroup cli | |
| 19 | + * \page cli_age_estimation Age Estimation | |
| 20 | + * \ref cpp_age_estimation "C++ Equivalent" | |
| 21 | + * \code | |
| 22 | + * $ br -algorithm AgeEstimation \ | |
| 23 | + * -enroll ../data/MEDS/img/S354-01-t10_01.jpg ../data/MEDS/img/S001-01-t10_01.jpg metadata.csv | |
| 24 | + * \endcode | |
| 25 | + */ | |
| 26 | + | |
| 27 | +//! [age_estimation] | |
| 28 | +#include <openbr_plugin.h> | |
| 29 | + | |
| 30 | +static void printTemplate(const br::Template &t) | |
| 31 | +{ | |
| 32 | + printf("%s age: %d\n", | |
| 33 | + qPrintable(t.file.fileName()), | |
| 34 | + t.file.getInt("Label")); | |
| 35 | +} | |
| 36 | + | |
| 37 | +int main(int argc, char *argv[]) | |
| 38 | +{ | |
| 39 | + br::Context::initialize(argc, argv); | |
| 40 | + | |
| 41 | + // Retrieve class for enrolling templates using the AgeEstimation algorithm | |
| 42 | + QSharedPointer<br::Transform> transform = br::Transform::fromAlgorithm("AgeEstimation"); | |
| 43 | + | |
| 44 | + // Initialize templates | |
| 45 | + br::Template queryA("../data/MEDS/img/S354-01-t10_01.jpg"); | |
| 46 | + br::Template queryB("../data/MEDS/img/S001-01-t10_01.jpg"); | |
| 47 | + | |
| 48 | + // Enroll templates | |
| 49 | + queryA >> *transform; | |
| 50 | + queryB >> *transform; | |
| 51 | + | |
| 52 | + printTemplate(queryA); | |
| 53 | + printTemplate(queryB); | |
| 54 | + | |
| 55 | + br::Context::finalize(); | |
| 56 | + return 0; | |
| 57 | +} | |
| 58 | +//! [age_estimation] | ... | ... |
app/examples/compare_faces.cpp renamed to app/examples/face_recognition.cpp
| ... | ... | @@ -16,8 +16,8 @@ |
| 16 | 16 | |
| 17 | 17 | /*! |
| 18 | 18 | * \ingroup cli |
| 19 | - * \page cli_compare_faces Compare Faces | |
| 20 | - * \ref cpp_compare_faces "Source Equivalent" | |
| 19 | + * \page cli_face_recognition Face Recognition | |
| 20 | + * \ref cpp_face_recognition "C++ Equivalent" | |
| 21 | 21 | * \code |
| 22 | 22 | * $ br -algorithm FaceRecognition \ |
| 23 | 23 | * -compare ../data/MEDS/img/S354-01-t10_01.jpg ../data/MEDS/img/S354-02-t10_01.jpg \ |
| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | * \endcode |
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | -//! [compare_faces] | |
| 28 | +//! [face_recognition] | |
| 29 | 29 | #include <openbr_plugin.h> |
| 30 | 30 | |
| 31 | 31 | static void printTemplate(const br::Template &t) |
| ... | ... | @@ -68,4 +68,4 @@ int main(int argc, char *argv[]) |
| 68 | 68 | br::Context::finalize(); |
| 69 | 69 | return 0; |
| 70 | 70 | } |
| 71 | -//! [compare_faces] | |
| 71 | +//! [face_recognition] | ... | ... |
app/examples/evaluate_face_recognition.cpp renamed to app/examples/face_recognition_evaluation.cpp
| ... | ... | @@ -16,8 +16,8 @@ |
| 16 | 16 | |
| 17 | 17 | /*! |
| 18 | 18 | * \ingroup cli |
| 19 | - * \page cli_evaluate_face_recognition Evaluate Face Recognition | |
| 20 | - * \ref c_evaluate_face_recognition "Source Equivalent" | |
| 19 | + * \page cli_face_recognition_evaluation Face Recognition Evaluation | |
| 20 | + * \ref c_face_recognition_evaluation "C Equivalent" | |
| 21 | 21 | * \code |
| 22 | 22 | * $ br -algorithm FaceRecognition -path ../data/MEDS/img/ \ |
| 23 | 23 | * -enroll ../data/MEDS/sigset/MEDS_frontal_target.xml target.gal \ |
| ... | ... | @@ -30,7 +30,7 @@ |
| 30 | 30 | * \endcode |
| 31 | 31 | */ |
| 32 | 32 | |
| 33 | -//! [evaluate_face_recognition] | |
| 33 | +//! [face_recognition_evaluation] | |
| 34 | 34 | #include <openbr.h> |
| 35 | 35 | |
| 36 | 36 | int main(int argc, char *argv[]) |
| ... | ... | @@ -67,4 +67,4 @@ int main(int argc, char *argv[]) |
| 67 | 67 | br_finalize(); |
| 68 | 68 | return 0; |
| 69 | 69 | } |
| 70 | -//! [evaluate_face_recognition] | |
| 70 | +//! [face_recognition_evaluation] | ... | ... |
app/examples/gender_estimation.cpp
0 → 100644
| 1 | +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
| 2 | + * Copyright 2012 The MITRE Corporation * | |
| 3 | + * * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); * | |
| 5 | + * you may not use this file except in compliance with the License. * | |
| 6 | + * You may obtain a copy of the License at * | |
| 7 | + * * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 * | |
| 9 | + * * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software * | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, * | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * | |
| 13 | + * See the License for the specific language governing permissions and * | |
| 14 | + * limitations under the License. * | |
| 15 | + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
| 16 | + | |
| 17 | +/*! | |
| 18 | + * \ingroup cli | |
| 19 | + * \page cli_gender_estimation Gender Estimation | |
| 20 | + * \ref cpp_gender_estimation "C++ Equivalent" | |
| 21 | + * \code | |
| 22 | + * $ br -algorithm GenderEstimation \ | |
| 23 | + * -enroll ../data/MEDS/img/S354-01-t10_01.jpg ../data/MEDS/img/S001-01-t10_01.jpg metadata.csv | |
| 24 | + * \endcode | |
| 25 | + */ | |
| 26 | + | |
| 27 | +//! [gender_estimation] | |
| 28 | +#include <openbr_plugin.h> | |
| 29 | + | |
| 30 | +static void printTemplate(const br::Template &t) | |
| 31 | +{ | |
| 32 | + printf("%s gender: %s\n", | |
| 33 | + qPrintable(t.file.fileName()), | |
| 34 | + t.file.getInt("Label") == 1 ? "Female" : "Male"); | |
| 35 | +} | |
| 36 | + | |
| 37 | +int main(int argc, char *argv[]) | |
| 38 | +{ | |
| 39 | + br::Context::initialize(argc, argv); | |
| 40 | + | |
| 41 | + // Retrieve class for enrolling templates using the GenderEstimation algorithm | |
| 42 | + QSharedPointer<br::Transform> transform = br::Transform::fromAlgorithm("GenderEstimation"); | |
| 43 | + | |
| 44 | + // Initialize templates | |
| 45 | + br::Template queryA("../data/MEDS/img/S354-01-t10_01.jpg"); | |
| 46 | + br::Template queryB("../data/MEDS/img/S001-01-t10_01.jpg"); | |
| 47 | + | |
| 48 | + // Enroll templates | |
| 49 | + queryA >> *transform; | |
| 50 | + queryB >> *transform; | |
| 51 | + | |
| 52 | + printTemplate(queryA); | |
| 53 | + printTemplate(queryB); | |
| 54 | + | |
| 55 | + br::Context::finalize(); | |
| 56 | + return 0; | |
| 57 | +} | |
| 58 | +//! [gender_estimation] | ... | ... |
sdk/core/qtutils.cpp
| ... | ... | @@ -288,7 +288,9 @@ bool QtUtils::runDot(const QString &file) |
| 288 | 288 | void QtUtils::showFile(const QString &file) |
| 289 | 289 | { |
| 290 | 290 | #ifndef BR_EMBEDDED |
| 291 | - QDesktopServices::openUrl(QUrl::fromLocalFile(file)); | |
| 291 | + (void) file; | |
| 292 | + // A bug in Qt5 currently prevents us from doing this: | |
| 293 | + // QDesktopServices::openUrl(QUrl::fromLocalFile(file)); | |
| 292 | 294 | #else // BR_EMBEDDED |
| 293 | 295 | (void) file; |
| 294 | 296 | #endif // BR_EMBEDDED | ... | ... |
sdk/openbr.h
| ... | ... | @@ -54,10 +54,11 @@ extern "C" { |
| 54 | 54 | * \endcode |
| 55 | 55 | * |
| 56 | 56 | * \section examples Examples |
| 57 | - * - \ref c_evaluate_face_recognition | |
| 58 | - * \subsection c_evaluate_face_recognition Evaluate Face Recognition | |
| 59 | - * \ref cli_evaluate_face_recognition "Command Line Interface Equivalent" | |
| 60 | - * \snippet app/examples/evaluate_face_recognition.cpp evaluate_face_recognition | |
| 57 | + * - \ref c_face_recognition_evaluation | |
| 58 | + * | |
| 59 | + * \subsection c_face_recognition_evaluation Face Recognition Evaluation | |
| 60 | + * \ref cli_face_recognition_evaluation "Command Line Interface Equivalent" | |
| 61 | + * \snippet app/examples/face_recognition_evaluation.cpp face_recognition_evaluation | |
| 61 | 62 | */ |
| 62 | 63 | |
| 63 | 64 | /*! | ... | ... |
sdk/openbr_export.cpp
| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | * \section overview Overview |
| 20 | 20 | * OpenBR \cite openbr is a toolkit for biometric recognition and evaluation. |
| 21 | 21 | * Supported use cases include training new recognition algorithms, interfacing with commercial systems, and measuring algorithm performance. |
| 22 | - * Free algorithms are also available for specific modalities including face recognition, face gender \& age estimation, face quality, and document classification. | |
| 22 | + * Free algorithms are also available for specific modalities including \ref cpp_face_recognition, \ref cpp_age_estimation, and \ref cpp_gender_estimation. | |
| 23 | 23 | * |
| 24 | 24 | * There are three modules users may interact with: |
| 25 | 25 | * - \ref cli - \copybrief cli |
| ... | ... | @@ -32,7 +32,7 @@ |
| 32 | 32 | |
| 33 | 33 | /*! |
| 34 | 34 | * \page installation Installation |
| 35 | - * \brief A hacker's guide to building, editing, and running the source code. | |
| 35 | + * \brief A hacker's guide to building, editing, and running the project. | |
| 36 | 36 | * |
| 37 | 37 | * \section installation_from_source From Source |
| 38 | 38 | * Installation from source is the recommended method for getting OpenBR on your machine. |
| ... | ... | @@ -44,7 +44,7 @@ |
| 44 | 44 | * - \subpage linux_icc |
| 45 | 45 | * |
| 46 | 46 | * \section installation_from_binary From Binary |
| 47 | - * Pre-built releases are generally not provided, though they can be built from source using the instructions above. | |
| 47 | + * Pre-compiled releases are not currently provided, but they can be built from source using the instructions above. | |
| 48 | 48 | * Generally you should follow your operating system's best practices for installing a binary package. |
| 49 | 49 | * However, for temporary evaluation, one simple configuration approach is: |
| 50 | 50 | * |
| ... | ... | @@ -104,7 +104,7 @@ $ br -help |
| 104 | 104 | * \endcode |
| 105 | 105 | * -# <http://releases.qt-project.org/qt5/5.0.1/single/qt-everywhere-opensource-src-5.0.1.zip">Download Qt 5.0.1</a> and install: |
| 106 | 106 | * -# Unzip "qt-everywhere-opensource-src-5.0.1.zip" |
| 107 | - * -# Install Perl/Python/Ruby dependencies as explained in the "Windows" section of "qt-everywhere-opensource-src-5.0.1\README". | |
| 107 | + * -# Install Perl/Python/Ruby dependencies as explained in the "Windows" section of "qt-everywhere-opensource-src-5.0.1\\README". | |
| 108 | 108 | * -# From the VS2012 x64 Cross Tools Command Prompt: |
| 109 | 109 | * \code |
| 110 | 110 | * $ cd qt-everywhere-opensource-src-5.0.1 |
| ... | ... | @@ -183,7 +183,7 @@ $ br -help |
| 183 | 183 | * \endcode |
| 184 | 184 | * -# <http://releases.qt-project.org/qt5/5.0.1/single/qt-everywhere-opensource-src-5.0.1.zip">Download Qt 5.0.1</a> and install: |
| 185 | 185 | * -# Unzip "qt-everywhere-opensource-src-5.0.1.zip" |
| 186 | - * -# Install Perl/Python/Ruby dependencies as explained in the "Windows" section of "qt-everywhere-opensource-src-5.0.1\README". | |
| 186 | + * -# Install Perl/Python/Ruby dependencies as explained in the "Windows" section of "qt-everywhere-opensource-src-5.0.1\\README". | |
| 187 | 187 | * -# From the MinGW-w64 Command Prompt: |
| 188 | 188 | * \code |
| 189 | 189 | * $ cd qt-everywhere-opensource-src-5.0.1 | ... | ... |
sdk/openbr_plugin.h
| ... | ... | @@ -60,10 +60,21 @@ |
| 60 | 60 | * Plugin authors are encouraged to <tt>\\cite</tt> relevant papers by adding them to <tt>share/openbr/openbr.bib</tt>. |
| 61 | 61 | * |
| 62 | 62 | * \section examples Examples |
| 63 | - * - \ref cpp_compare_faces | |
| 64 | - * \subsection cpp_compare_faces Compare Faces | |
| 65 | - * \ref cli_compare_faces "Command Line Interface Equivalent" | |
| 66 | - * \snippet app/examples/compare_faces.cpp compare_faces | |
| 63 | + * - \ref cpp_face_recognition | |
| 64 | + * - \ref cpp_age_estimation | |
| 65 | + * - \ref cpp_gender_estimation | |
| 66 | + * | |
| 67 | + * \subsection cpp_face_recognition Face Recognition | |
| 68 | + * \ref cli_face_recognition "Command Line Interface Equivalent" | |
| 69 | + * \snippet app/examples/face_recognition.cpp face_recognition | |
| 70 | + * | |
| 71 | + * \subsection cpp_age_estimation Age Estimation | |
| 72 | + * \ref cli_age_estimation "Command Line Interface Equivalent" | |
| 73 | + * \snippet app/examples/age_estimation.cpp age_estimation | |
| 74 | + * | |
| 75 | + * \subsection cpp_gender_estimation Gender Estimation | |
| 76 | + * \ref cli_gender_estimation "Command Line Interface Equivalent" | |
| 77 | + * \snippet app/examples/gender_estimation.cpp gender_estimation | |
| 67 | 78 | */ |
| 68 | 79 | |
| 69 | 80 | namespace br | ... | ... |
sdk/plugins/algorithms.cpp
| ... | ... | @@ -39,6 +39,8 @@ class AlgorithmsInitializer : public Initializer |
| 39 | 39 | Globals->abbreviations.insert("MedianFace", "Open!Cascade(FrontalFace)+ASEFEyes+Affine(256,256,0.37,0.45)+Center(Median)"); |
| 40 | 40 | Globals->abbreviations.insert("BlurredFaceDetection", "Open+LimitSize(1024)+SkinMask/(Cvt(Gray)+GradientMask)+And+Morph(Erode,16)+LargestConvexArea"); |
| 41 | 41 | Globals->abbreviations.insert("OpenBR", "FaceRecognition"); |
| 42 | + Globals->abbreviations.insert("GenderEstimation", "GenderClassification"); | |
| 43 | + Globals->abbreviations.insert("AgeEstimation", "AgeRegression"); | |
| 42 | 44 | |
| 43 | 45 | // Generic Image Processing |
| 44 | 46 | Globals->abbreviations.insert("SIFT", "Open+KeyPointDetector(SIFT)+KeyPointDescriptor(SIFT):KeyPointMatcher(BruteForce)"); |
| ... | ... | @@ -59,8 +61,6 @@ class AlgorithmsInitializer : public Initializer |
| 59 | 61 | Globals->abbreviations.insert("ColoredLBP", "Open+Affine(128,128,0.37,0.45)+Cvt(Gray)+Blur(1.1)+Gamma(0.2)+DoG(1,2)+ContrastEq(0.1,10)+LBP(1,2)+ColoredU2"); |
| 60 | 62 | |
| 61 | 63 | // Transforms |
| 62 | - Globals->abbreviations.insert("SketchDetector", "(Cvt(Gray)+Cascade(FrontalFace)+ASEFEyes+RenameFirst([eyeLx,ASEF_Right_Eye_X],Affine_0_X)+RenameFirst([eyeLy,ASEF_Right_Eye_Y],Affine_0_Y)+RenameFirst([eyeRx,ASEF_Left_Eye_X],Affine_1_X)+RenameFirst([eyeRy,ASEF_Left_Eye_Y],Affine_1_Y))"); | |
| 63 | - // Globals->abbreviations.insert("SketchDetector", "(EnsureChannels(3)+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)+Cvt(Gray))"); | |
| 64 | 64 | Globals->abbreviations.insert("FaceDetection", "(Open+Cvt(Gray)+Cascade(FrontalFace))"); |
| 65 | 65 | Globals->abbreviations.insert("DenseLBP", "(Blur(1.1)+Gamma(0.2)+DoG(1,2)+ContrastEq(0.1,10)+LBP(1,2)+RectRegions(8,8,6,6)+Hist(59))"); |
| 66 | 66 | Globals->abbreviations.insert("DenseSIFT", "(Grid(10,10)+SIFTDescriptor(12)+ByRow)"); | ... | ... |