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

Function main

example/run_video_localization.cc:173–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171}
172
173int main(int argc, char *argv[])
174{
175#ifdef USE_STACK_TRACE_LOGGER
176 google::InitGoogleLogging(argv[0]);
177 google::InstallFailureSignalHandler();
178#endif
179
180 // create options
181 popl::OptionParser op("Allowed options");
182 auto help = op.add<popl::Switch>("h", "help", "produce help message");
183 auto vocab_file_path = op.add<popl::Value<std::string>>("v", "vocab", "vocabulary file path");
184 auto video_file_path = op.add<popl::Value<std::string>>("m", "video", "video file path");
185 auto config_file_path = op.add<popl::Value<std::string>>("c", "config", "config file path");
186 auto map_db_path = op.add<popl::Value<std::string>>("p", "map-db", "path to a prebuilt map database");
187 auto mapping = op.add<popl::Switch>("", "mapping", "perform mapping as well as localization");
188 auto mask_img_path = op.add<popl::Value<std::string>>("", "mask", "mask image path", "");
189 auto frame_skip = op.add<popl::Value<unsigned int>>("", "frame-skip", "interval of frame skip", 1);
190 auto no_sleep = op.add<popl::Switch>("", "no-sleep", "not wait for next frame in real time");
191 auto auto_term = op.add<popl::Switch>("", "auto-term", "automatically terminate the viewer");
192 auto debug_mode = op.add<popl::Switch>("", "debug", "debug mode");
193 try
194 {
195 op.parse(argc, argv);
196 }
197 catch (const std::exception &e)
198 {
199 std::cerr << e.what() << std::endl;
200 std::cerr << std::endl;
201 std::cerr << op << std::endl;
202 return EXIT_FAILURE;
203 }
204
205 // check validness of options
206 if (help->is_set())
207 {
208 std::cerr << op << std::endl;
209 return EXIT_FAILURE;
210 }
211 if (!vocab_file_path->is_set() || !video_file_path->is_set() || !config_file_path->is_set() || !map_db_path->is_set())
212 {
213 std::cerr << "invalid arguments" << std::endl;
214 std::cerr << std::endl;
215 std::cerr << op << std::endl;
216 return EXIT_FAILURE;
217 }
218
219 // setup logger
220 spdlog::set_pattern("[%Y-%m-%d %H:%M:%S.%e] %^[%L] %v%$");
221 if (debug_mode->is_set())
222 {
223 spdlog::set_level(spdlog::level::debug);
224 }
225 else
226 {
227 spdlog::set_level(spdlog::level::info);
228 }
229
230 // 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_localizationFunction · 0.70
parseMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected