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

Function main

example/run_camera_slam.cc:261–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261int main(int argc, char *argv[])
262{
263#ifdef USE_STACK_TRACE_LOGGER
264 google::InitGoogleLogging(argv[0]);
265 google::InstallFailureSignalHandler();
266#endif
267
268 // create options
269 popl::OptionParser op("Allowed options");
270 auto help = op.add<popl::Switch>("h", "help", "produce help message");
271 auto vocab_file_path = op.add<popl::Value<std::string>>("v", "vocab", "vocabulary file path");
272 auto cam_num = op.add<popl::Value<unsigned int>>("n", "number", "camera number");
273 auto config_file_path = op.add<popl::Value<std::string>>("c", "config", "config file path");
274 auto mask_img_path = op.add<popl::Value<std::string>>("", "mask", "mask image path", "");
275 auto scale = op.add<popl::Value<float>>("s", "scale", "scaling ratio of images", 1.0);
276 auto map_db_path = op.add<popl::Value<std::string>>("p", "map-db", "store a map database at this path after SLAM", "");
277 auto debug_mode = op.add<popl::Switch>("", "debug", "debug mode");
278 try
279 {
280 op.parse(argc, argv);
281 }
282 catch (const std::exception &e)
283 {
284 std::cerr << e.what() << std::endl;
285 std::cerr << std::endl;
286 std::cerr << op << std::endl;
287 return EXIT_FAILURE;
288 }
289
290 // check validness of options
291 if (help->is_set())
292 {
293 std::cerr << op << std::endl;
294 return EXIT_FAILURE;
295 }
296 if (!vocab_file_path->is_set() || !cam_num->is_set() || !config_file_path->is_set())
297 {
298 std::cerr << "invalid arguments" << std::endl;
299 std::cerr << std::endl;
300 std::cerr << op << std::endl;
301 return EXIT_FAILURE;
302 }
303
304 // setup logger
305 spdlog::set_pattern("[%Y-%m-%d %H:%M:%S.%e] %^[%L] %v%$");
306 if (debug_mode->is_set())
307 {
308 spdlog::set_level(spdlog::level::debug);
309 }
310 else
311 {
312 spdlog::set_level(spdlog::level::info);
313 }
314
315 // load configuration
316 std::shared_ptr<PLPSLAM::config> cfg;
317 try
318 {

Callers

nothing calls this directly

Calls 9

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
stereo_trackingFunction · 0.70
parseMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected