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 void loadConfig(std::string& config_file); 00045 void common(); 00046 public: 00047 enum DETECTOR_TYPE{ 00048 DMTX, ZBAR 00049 }; 00050 enum TRACKER_TYPE{ 00051 KLT, MBT, KLT_MBT 00052 }; 00053 00054 CmdLine(int argc,char**argv); 00055 CmdLine(std::string& config_file); 00056 00057 bool show_plot() const; 00058 00059 bool using_hinkley() const; 00060 00061 vpCameraParameters get_cam_calib_params() const; 00062 00063 double get_hinkley_alpha() const; 00064 00065 double get_hinkley_delta() const; 00066 00067 bool dmtx_only() const; 00068 00069 bool should_exit() const; 00070 00071 std::string get_log_file_pattern() const; 00072 00073 std::string get_input_file_pattern() const; 00074 00075 std::string get_video_channel() const; 00076 00077 bool show_fps() const; 00078 00079 int get_mbt_convergence_steps() const; 00080 00081 double get_mbt_dynamic_range() const; 00082 00083 double get_adhoc_recovery_size() const; 00084 00085 bool log_checkpoints() const; 00086 00087 bool log_pose() const; 00088 00089 bool using_mbt_dynamic_range(); 00090 00091 bool get_verbose() const; 00092 00093 int get_dmx_timeout() const; 00094 00095 double get_inner_ratio() const; 00096 00097 double get_outer_ratio() const; 00098 00099 bool using_data_dir() const; 00100 00101 bool using_video_camera() const; 00102 00103 std::string get_data_dir() const; 00104 00105 std::string get_pattern_name() const; 00106 00107 std::string get_wrl_file() const; 00108 00109 std::string get_xml_file() const; 00110 00111 std::string get_init_file() const; 00112 00113 std::string get_var_file() const; 00114 00115 bool using_single_image() const; 00116 00117 bool using_var_file() const; 00118 00119 double get_var_limit() const; 00120 00121 double get_adhoc_recovery_ratio() const; 00122 00123 unsigned int get_adhoc_recovery_treshold() const; 00124 bool get_adhoc_recovery_display() const; 00125 00126 bool using_adhoc_recovery() const; 00127 00128 bool using_var_limit() const; 00129 00130 bool logging_video() const; 00131 00132 std::string get_single_image_path() const; 00133 00134 std::vector<vpPoint>& get_flashcode_points_3D(); 00135 std::vector<vpPoint>& get_inner_points_3D(); 00136 std::vector<vpPoint>& get_outer_points_3D(); 00137 00138 DETECTOR_TYPE get_detector_type() const; 00139 00140 TRACKER_TYPE get_tracker_type() const; 00141 00142 void set_data_directory(std::string dir); 00143 }; 00144 #endif