Commit 4ecb4d64ae5f3499e8d99fc91df2e999cab53b67

Authored by Josh Klontz
1 parent a2b90fc4

updated examples, finished #12

CMakeLists.txt
@@ -6,8 +6,8 @@ set(BR_SHARE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/share/openbr") @@ -6,8 +6,8 @@ set(BR_SHARE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/share/openbr")
6 set(CMAKE_AUTOMOC ON) 6 set(CMAKE_AUTOMOC ON)
7 set(CMAKE_INCLUDE_CURRENT_DIR ON) 7 set(CMAKE_INCLUDE_CURRENT_DIR ON)
8 set(CPACK_PACKAGE_NAME "OpenBR") 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 set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME}) 11 set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
12 set(CPACK_PACKAGE_VERSION_MAJOR 0) 12 set(CPACK_PACKAGE_VERSION_MAJOR 0)
13 set(CPACK_PACKAGE_VERSION_MINOR 2) 13 set(CPACK_PACKAGE_VERSION_MINOR 2)
app/br/br.cpp
@@ -31,8 +31,10 @@ @@ -31,8 +31,10 @@
31 * \endcode 31 * \endcode
32 * 32 *
33 * \section cli_examples Examples 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 static void help() 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,8 +16,8 @@
16 16
17 /*! 17 /*!
18 * \ingroup cli 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 * \code 21 * \code
22 * $ br -algorithm FaceRecognition \ 22 * $ br -algorithm FaceRecognition \
23 * -compare ../data/MEDS/img/S354-01-t10_01.jpg ../data/MEDS/img/S354-02-t10_01.jpg \ 23 * -compare ../data/MEDS/img/S354-01-t10_01.jpg ../data/MEDS/img/S354-02-t10_01.jpg \
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 * \endcode 25 * \endcode
26 */ 26 */
27 27
28 -//! [compare_faces] 28 +//! [face_recognition]
29 #include <openbr_plugin.h> 29 #include <openbr_plugin.h>
30 30
31 static void printTemplate(const br::Template &t) 31 static void printTemplate(const br::Template &t)
@@ -68,4 +68,4 @@ int main(int argc, char *argv[]) @@ -68,4 +68,4 @@ int main(int argc, char *argv[])
68 br::Context::finalize(); 68 br::Context::finalize();
69 return 0; 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,8 +16,8 @@
16 16
17 /*! 17 /*!
18 * \ingroup cli 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 * \code 21 * \code
22 * $ br -algorithm FaceRecognition -path ../data/MEDS/img/ \ 22 * $ br -algorithm FaceRecognition -path ../data/MEDS/img/ \
23 * -enroll ../data/MEDS/sigset/MEDS_frontal_target.xml target.gal \ 23 * -enroll ../data/MEDS/sigset/MEDS_frontal_target.xml target.gal \
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 * \endcode 30 * \endcode
31 */ 31 */
32 32
33 -//! [evaluate_face_recognition] 33 +//! [face_recognition_evaluation]
34 #include <openbr.h> 34 #include <openbr.h>
35 35
36 int main(int argc, char *argv[]) 36 int main(int argc, char *argv[])
@@ -67,4 +67,4 @@ int main(int argc, char *argv[]) @@ -67,4 +67,4 @@ int main(int argc, char *argv[])
67 br_finalize(); 67 br_finalize();
68 return 0; 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 &amp;file) @@ -288,7 +288,9 @@ bool QtUtils::runDot(const QString &amp;file)
288 void QtUtils::showFile(const QString &file) 288 void QtUtils::showFile(const QString &file)
289 { 289 {
290 #ifndef BR_EMBEDDED 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 #else // BR_EMBEDDED 294 #else // BR_EMBEDDED
293 (void) file; 295 (void) file;
294 #endif // BR_EMBEDDED 296 #endif // BR_EMBEDDED
sdk/openbr.h
@@ -54,10 +54,11 @@ extern &quot;C&quot; { @@ -54,10 +54,11 @@ extern &quot;C&quot; {
54 * \endcode 54 * \endcode
55 * 55 *
56 * \section examples Examples 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,7 +19,7 @@
19 * \section overview Overview 19 * \section overview Overview
20 * OpenBR \cite openbr is a toolkit for biometric recognition and evaluation. 20 * OpenBR \cite openbr is a toolkit for biometric recognition and evaluation.
21 * Supported use cases include training new recognition algorithms, interfacing with commercial systems, and measuring algorithm performance. 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 * There are three modules users may interact with: 24 * There are three modules users may interact with:
25 * - \ref cli - \copybrief cli 25 * - \ref cli - \copybrief cli
@@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
32 32
33 /*! 33 /*!
34 * \page installation Installation 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 * \section installation_from_source From Source 37 * \section installation_from_source From Source
38 * Installation from source is the recommended method for getting OpenBR on your machine. 38 * Installation from source is the recommended method for getting OpenBR on your machine.
@@ -44,7 +44,7 @@ @@ -44,7 +44,7 @@
44 * - \subpage linux_icc 44 * - \subpage linux_icc
45 * 45 *
46 * \section installation_from_binary From Binary 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 * Generally you should follow your operating system's best practices for installing a binary package. 48 * Generally you should follow your operating system's best practices for installing a binary package.
49 * However, for temporary evaluation, one simple configuration approach is: 49 * However, for temporary evaluation, one simple configuration approach is:
50 * 50 *
@@ -104,7 +104,7 @@ $ br -help @@ -104,7 +104,7 @@ $ br -help
104 * \endcode 104 * \endcode
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: 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 * -# Unzip "qt-everywhere-opensource-src-5.0.1.zip" 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 * -# From the VS2012 x64 Cross Tools Command Prompt: 108 * -# From the VS2012 x64 Cross Tools Command Prompt:
109 * \code 109 * \code
110 * $ cd qt-everywhere-opensource-src-5.0.1 110 * $ cd qt-everywhere-opensource-src-5.0.1
@@ -183,7 +183,7 @@ $ br -help @@ -183,7 +183,7 @@ $ br -help
183 * \endcode 183 * \endcode
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: 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 * -# Unzip "qt-everywhere-opensource-src-5.0.1.zip" 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 * -# From the MinGW-w64 Command Prompt: 187 * -# From the MinGW-w64 Command Prompt:
188 * \code 188 * \code
189 * $ cd qt-everywhere-opensource-src-5.0.1 189 * $ cd qt-everywhere-opensource-src-5.0.1
sdk/openbr_plugin.h
@@ -60,10 +60,21 @@ @@ -60,10 +60,21 @@
60 * Plugin authors are encouraged to <tt>\\cite</tt> relevant papers by adding them to <tt>share/openbr/openbr.bib</tt>. 60 * Plugin authors are encouraged to <tt>\\cite</tt> relevant papers by adding them to <tt>share/openbr/openbr.bib</tt>.
61 * 61 *
62 * \section examples Examples 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 namespace br 80 namespace br
sdk/plugins/algorithms.cpp
@@ -39,6 +39,8 @@ class AlgorithmsInitializer : public Initializer @@ -39,6 +39,8 @@ class AlgorithmsInitializer : public Initializer
39 Globals->abbreviations.insert("MedianFace", "Open!Cascade(FrontalFace)+ASEFEyes+Affine(256,256,0.37,0.45)+Center(Median)"); 39 Globals->abbreviations.insert("MedianFace", "Open!Cascade(FrontalFace)+ASEFEyes+Affine(256,256,0.37,0.45)+Center(Median)");
40 Globals->abbreviations.insert("BlurredFaceDetection", "Open+LimitSize(1024)+SkinMask/(Cvt(Gray)+GradientMask)+And+Morph(Erode,16)+LargestConvexArea"); 40 Globals->abbreviations.insert("BlurredFaceDetection", "Open+LimitSize(1024)+SkinMask/(Cvt(Gray)+GradientMask)+And+Morph(Erode,16)+LargestConvexArea");
41 Globals->abbreviations.insert("OpenBR", "FaceRecognition"); 41 Globals->abbreviations.insert("OpenBR", "FaceRecognition");
  42 + Globals->abbreviations.insert("GenderEstimation", "GenderClassification");
  43 + Globals->abbreviations.insert("AgeEstimation", "AgeRegression");
42 44
43 // Generic Image Processing 45 // Generic Image Processing
44 Globals->abbreviations.insert("SIFT", "Open+KeyPointDetector(SIFT)+KeyPointDescriptor(SIFT):KeyPointMatcher(BruteForce)"); 46 Globals->abbreviations.insert("SIFT", "Open+KeyPointDetector(SIFT)+KeyPointDescriptor(SIFT):KeyPointMatcher(BruteForce)");
@@ -59,8 +61,6 @@ class AlgorithmsInitializer : public Initializer @@ -59,8 +61,6 @@ class AlgorithmsInitializer : public Initializer
59 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"); 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 // Transforms 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 Globals->abbreviations.insert("FaceDetection", "(Open+Cvt(Gray)+Cascade(FrontalFace))"); 64 Globals->abbreviations.insert("FaceDetection", "(Open+Cvt(Gray)+Cascade(FrontalFace))");
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))"); 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 Globals->abbreviations.insert("DenseSIFT", "(Grid(10,10)+SIFTDescriptor(12)+ByRow)"); 66 Globals->abbreviations.insert("DenseSIFT", "(Grid(10,10)+SIFTDescriptor(12)+ByRow)");