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

Function main

example/run_image_slam.cc:179–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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