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

Function main

example/run_video_slam.cc:185–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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