MCPcopy Create free account
hub / github.com/PeterFWS/Structure-PLP-SLAM / main

Function main

example/run_image_slam_planeSeg.cc:193–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191}
192
193int main(int argc, char *argv[])
194{
195#ifdef USE_STACK_TRACE_LOGGER
196 google::InitGoogleLogging(argv[0]);
197 google::InstallFailureSignalHandler();
198#endif
199
200 // create options
201 popl::OptionParser op("Allowed options");
202 auto help = op.add<popl::Switch>("h", "help", "produce help message");
203 auto vocab_file_path = op.add<popl::Value<std::string>>("v", "vocab", "vocabulary file path");
204 auto img_dir_path = op.add<popl::Value<std::string>>("i", "img-dir", "directory path which contains images");
205 auto config_file_path = op.add<popl::Value<std::string>>("c", "config", "config file path");
206 auto mask_img_path = op.add<popl::Value<std::string>>("", "mask", "mask image path", "");
207 auto frame_skip = op.add<popl::Value<unsigned int>>("", "frame-skip", "interval of frame skip", 1);
208 auto no_sleep = op.add<popl::Switch>("", "no-sleep", "not wait for next frame in real time");
209 auto auto_term = op.add<popl::Switch>("", "auto-term", "automatically terminate the viewer");
210 auto debug_mode = op.add<popl::Switch>("", "debug", "debug mode");
211 auto eval_log = op.add<popl::Switch>("", "eval-log", "store trajectory and tracking times for evaluation");
212 auto map_db_path = op.add<popl::Value<std::string>>("p", "map-db", "store a map database at this path after SLAM", "");
213 try
214 {
215 op.parse(argc, argv);
216 }
217 catch (const std::exception &e)
218 {
219 std::cerr << e.what() << std::endl;
220 std::cerr << std::endl;
221 std::cerr << op << std::endl;
222 return EXIT_FAILURE;
223 }
224
225 // check validness of options
226 if (help->is_set())
227 {
228 std::cerr << op << std::endl;
229 return EXIT_FAILURE;
230 }
231 if (!vocab_file_path->is_set() || !img_dir_path->is_set() || !config_file_path->is_set())
232 {
233 std::cerr << "invalid arguments" << std::endl;
234 std::cerr << std::endl;
235 std::cerr << op << std::endl;
236 return EXIT_FAILURE;
237 }
238
239 // setup logger
240 spdlog::set_pattern("[%Y-%m-%d %H:%M:%S.%e] %^[%L] %v%$");
241 if (debug_mode->is_set())
242 {
243 spdlog::set_level(spdlog::level::debug);
244 }
245 else
246 {
247 spdlog::set_level(spdlog::level::info);
248 }
249
250 // load configuration

Callers

nothing calls this directly

Calls 8

set_patternFunction · 0.85
set_levelFunction · 0.85
whatMethod · 0.80
is_setMethod · 0.80
get_setup_type_stringMethod · 0.80
mono_trackingFunction · 0.70
parseMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected