From 768e67e35ccfe7c915f6724f6d020095e665edb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9verin=20Lemaignan?= Date: Tue, 28 Feb 2017 16:35:58 +0000 Subject: [PATCH] Added a version (1.0.0) --- CMakeLists.txt | 7 ++++++- .../benchmark_head_pose_estimation_single_frame.cpp | 7 +++++-- tools/estimate_head_direction.cpp | 11 ++++++++++- tools/show_head_pose.cpp | 13 +++++++++++-- 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a14d09d..627b2a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,12 @@ cmake_minimum_required(VERSION 2.8.3) project(gazr) -add_definitions(-std=c++11) +set(CPACK_PACKAGE_VERSION_MAJOR "1") +set(CPACK_PACKAGE_VERSION_MINOR "0") +set(CPACK_PACKAGE_VERSION_PATCH "0") +set(VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}) + +add_definitions(-std=c++11 -DGAZR_VERSION=${VERSION}) find_package(dlib REQUIRED) include_directories(${dlib_INCLUDE_DIRS}) diff --git a/tools/benchmark_head_pose_estimation_single_frame.cpp b/tools/benchmark_head_pose_estimation_single_frame.cpp index 65a7b68..82c4249 100644 --- a/tools/benchmark_head_pose_estimation_single_frame.cpp +++ b/tools/benchmark_head_pose_estimation_single_frame.cpp @@ -1,3 +1,6 @@ +#define STR_EXPAND(tok) #tok +#define STR(tok) STR_EXPAND(tok) + #ifdef OPENCV3 #include #else @@ -18,8 +21,8 @@ int main(int argc, char **argv) Mat frame; if(argc < 3) { - cerr << "Usage: " << endl << - "head_pose model.dat frame.{jpg|png}" << endl; + cerr << argv[0] << " " << STR(GAZR_VERSION) << "\n\nUsage: " + << endl << argv[0] << " model.dat frame.{jpg|png}" << endl; #ifdef HEAD_POSE_ESTIMATION_DEBUG cerr << "Output: a new frame 'head_pose_.png'" << endl; #endif diff --git a/tools/estimate_head_direction.cpp b/tools/estimate_head_direction.cpp index 2d6dd84..40a3739 100644 --- a/tools/estimate_head_direction.cpp +++ b/tools/estimate_head_direction.cpp @@ -9,6 +9,9 @@ #include "../src/head_pose_estimation.hpp" +#define STR_EXPAND(tok) #tok +#define STR(tok) STR_EXPAND(tok) + using namespace std; using namespace cv; namespace po = boost::program_options; @@ -30,6 +33,7 @@ int main(int argc, char **argv) po::options_description desc("Allowed options"); desc.add_options() ("help,h", "produce help message") + ("version,v", "shows version and exits") ("show,s", "display the image with gaze estimation") ("model", po::value(), "dlib's trained face model") ("image", po::value(), "image to process (png, jpg)") @@ -43,10 +47,15 @@ int main(int argc, char **argv) po::notify(vm); if (vm.count("help")) { - cout << "estimate_gaze_direction\n\n" << desc << "\n"; + cout << argv[0] << " " << STR(GAZR_VERSION) << "\n\n" << desc << "\n"; return 1; } + if (vm.count("version")) { + cout << argv[0] << " " << STR(GAZR_VERSION) << "\n"; + return 0; + } + if (vm.count("show")) { show_frame = true; } diff --git a/tools/show_head_pose.cpp b/tools/show_head_pose.cpp index 3e030e0..6ab64aa 100644 --- a/tools/show_head_pose.cpp +++ b/tools/show_head_pose.cpp @@ -6,6 +6,9 @@ #include "../src/head_pose_estimation.hpp" +#define STR_EXPAND(tok) #tok +#define STR(tok) STR_EXPAND(tok) + using namespace std; using namespace cv; namespace po = boost::program_options; @@ -27,7 +30,8 @@ int main(int argc, char **argv) po::options_description desc("Allowed options"); desc.add_options() - ("help,h", "produce help message") + ("help,h", "produces help message") + ("version,v", "shows version and exits") ("model", po::value(), "dlib's trained face model") ("video", po::value(), "video to process. If omitted, uses the first webcam") ; @@ -40,10 +44,15 @@ int main(int argc, char **argv) po::notify(vm); if (vm.count("help")) { - cout << "estimate_gaze_direction\n\n" << desc << "\n"; + cout << argv[0] << " " << STR(GAZR_VERSION) << "\n\n" << desc << "\n"; return 1; } + if (vm.count("version")) { + cout << argv[0] << " " << STR(GAZR_VERSION) << "\n"; + return 0; + } + if (vm.count("model") == 0) { cout << "You must specify the path to a trained dlib's face model\n" << "with the option --model." << endl;