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

Function main

example/run_camera_localization.cc:157–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157int main(int argc, char *argv[])
158{
159#ifdef USE_STACK_TRACE_LOGGER
160 google::InitGoogleLogging(argv[0]);
161 google::InstallFailureSignalHandler();
162#endif
163
164 // create options
165 popl::OptionParser op("Allowed options");
166 auto help = op.add<popl::Switch>("h", "help", "produce help message");
167 auto vocab_file_path = op.add<popl::Value<std::string>>("v", "vocab", "vocabulary file path");
168 auto cam_num = op.add<popl::Value<unsigned int>>("n", "number", "camera number");
169 auto config_file_path = op.add<popl::Value<std::string>>("c", "config", "config file path");
170 auto mask_img_path = op.add<popl::Value<std::string>>("", "mask", "mask image path", "");
171 auto scale = op.add<popl::Value<float>>("s", "scale", "scaling ratio of images", 1.0);
172 auto map_db_path = op.add<popl::Value<std::string>>("p", "map-db", "path to a prebuilt map database");
173 auto mapping = op.add<popl::Switch>("", "mapping", "perform mapping as well as localization");
174 auto debug_mode = op.add<popl::Switch>("", "debug", "debug mode");
175 try
176 {
177 op.parse(argc, argv);
178 }
179 catch (const std::exception &e)
180 {
181 std::cerr << e.what() << std::endl;
182 std::cerr << std::endl;
183 std::cerr << op << std::endl;
184 return EXIT_FAILURE;
185 }
186
187 // check validness of options
188 if (help->is_set())
189 {
190 std::cerr << op << std::endl;
191 return EXIT_FAILURE;
192 }
193 if (!vocab_file_path->is_set() || !cam_num->is_set() || !config_file_path->is_set() || !map_db_path->is_set())
194 {
195 std::cerr << "invalid arguments" << std::endl;
196 std::cerr << std::endl;
197 std::cerr << op << std::endl;
198 return EXIT_FAILURE;
199 }
200
201 // setup logger
202 spdlog::set_pattern("[%Y-%m-%d %H:%M:%S.%e] %^[%L] %v%$");
203 if (debug_mode->is_set())
204 {
205 spdlog::set_level(spdlog::level::debug);
206 }
207 else
208 {
209 spdlog::set_level(spdlog::level::info);
210 }
211
212 // load configuration
213 std::shared_ptr<PLPSLAM::config> cfg;
214 try

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