00001 #ifndef __CMD_LINE_H__ 00002 #define __CMD_LINE_H__ 00003 #include <boost/program_options/cmdline.hpp> 00004 #include <boost/program_options/variables_map.hpp> 00005 #include <boost/program_options/options_description.hpp> 00006 #include <boost/program_options/parsers.hpp> 00007 #include <exception> 00008 #include <string> 00009 #include <visp/vpConfig.h> 00010 #include <visp/vpPoint.h> 00011 namespace po = boost::program_options; 00012 class CmdLine{ 00013 private: 00014 boost::program_options::variables_map vm_; 00015 bool verbose_; 00016 bool show_fps_; 00017 bool show_plot_; 00018 bool log_pose_; 00019 bool should_exit_; 00020 std::string video_channel_; 00021 double inner_ratio_; 00022 double outer_ratio_; 00023 double var_limit_; 00024 bool adhoc_recovery_; 00025 bool adhoc_recovery_display_; 00026 double adhoc_recovery_ratio_; 00027 unsigned int adhoc_recovery_treshold_; 00028 double adhoc_recovery_size_; 00029 std::vector<double> hinkley_range_; 00030 int dmx_timeout_; 00031 int mbt_convergence_steps_; 00032 double mbt_dynamic_range_; 00033 std::string data_dir_; 00034 std::string pattern_name_; 00035 std::string var_file_; 00036 std::string single_image_name_; 00037 std::vector<vpPoint> flashcode_points_3D_; 00038 std::vector<vpPoint> inner_points_3D_,outer_points_3D_; 00039 00040 po::options_description prog_args; 00041 std::vector<double> flashcode_coordinates,inner_coordinates,outer_coordinates; 00042 std::string log_file_pattern_,input_file_pattern_; 00043 std::string config_file; 00044 std::string code_message_; // Code message used to specify which target to track 00045 int code_message_index_; // Index in the vector of code messages that were found 00046 void loadConfig(std::string& config_file); 00047 void common(); 00048 public: 00049 enum DETECTOR_TYPE{ 00050 DMTX, ZBAR 00051 }; 00052 enum TRACKER_TYPE{ 00053 KLT, MBT, KLT_MBT 00054 }; 00055 00056 CmdLine(); 00057 CmdLine(int argc,char**argv); 00058 CmdLine(std::string& config_file); 00059 void init(std::string& config_file); 00060 bool show_plot() const; 00061 00062 bool using_hinkley() const; 00063 00064 vpCameraParameters get_cam_calib_params() const; 00065 00066 double get_hinkley_alpha() const; 00067 00068 double get_hinkley_delta() const; 00069 00070 bool dmtx_only() const; 00071 00072 bool should_exit() const; 00073 00074 std::string get_log_file_pattern() const; 00075 00076 std::string get_input_file_pattern() const; 00077 00078 std::string get_video_channel() const; 00079 00080 bool show_fps() const; 00081 00082 int get_mbt_convergence_steps() const; 00083 00084 double get_mbt_dynamic_range() const; 00085 00086 double get_adhoc_recovery_size() const; 00087 00088 bool log_checkpoints() const; 00089 00090 bool log_pose() const; 00091 00092 bool using_mbt_dynamic_range(); 00093 00094 bool get_verbose() const; 00095 00096 int get_dmx_timeout() const; 00097 00098 double get_inner_ratio() const; 00099 00100 double get_outer_ratio() const; 00101 00102 bool using_data_dir() const; 00103 00104 bool using_video_camera() const; 00105 00106 std::string get_code_message() const; 00107 size_t get_code_message_index() const; 00108 00109 std::string get_data_dir() const; 00110 00111 std::string get_pattern_name() const; 00112 00113 std::string get_mbt_cad_file() const; // return wrl or cao file 00114 00115 std::string get_xml_file() const; 00116 00117 std::string get_init_file() const; 00118 00119 std::string get_var_file() const; 00120 00121 bool using_single_image() const; 00122 00123 bool using_var_file() const; 00124 00125 double get_var_limit() const; 00126 00127 double get_adhoc_recovery_ratio() const; 00128 00129 unsigned int get_adhoc_recovery_treshold() const; 00130 bool get_adhoc_recovery_display() const; 00131 00132 bool using_adhoc_recovery() const; 00133 00134 bool using_var_limit() const; 00135 00136 bool logging_video() const; 00137 00138 std::string get_single_image_path() const; 00139 00140 std::vector<vpPoint>& get_flashcode_points_3D(); 00141 std::vector<vpPoint>& get_inner_points_3D(); 00142 std::vector<vpPoint>& get_outer_points_3D(); 00143 00144 DETECTOR_TYPE get_detector_type() const; 00145 00146 TRACKER_TYPE get_tracker_type() const; 00147 00148 void set_code_message(const std::string &msg); 00149 void set_code_message_index(const size_t &index); 00150 void set_data_directory(std::string &dir); 00151 void set_pattern_name(std::string &name); 00152 void set_show_fps(bool show_fps); 00153 }; 00154 #endif