MCPcopy Create free account
hub / github.com/alicevision/AliceVision / aliceVision_main

Function aliceVision_main

src/software/export/main_exportColmap.cpp:29–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27namespace fs = std::filesystem;
28
29int aliceVision_main(int argc, char* argv[])
30{
31 std::string sfmDataFilename;
32 std::string outDirectory;
33 bool copyImages{false};
34
35 // clang-format off
36 po::options_description requiredParams("Required parameters");
37 requiredParams.add_options()
38 ("input,i", po::value<std::string>(&sfmDataFilename)->required(),
39 "SfMData file.")
40 ("output,o", po::value<std::string>(&outDirectory)->required(),
41 "The base path where the folder structure will be created with the relevant cameras.txt, images.txt "
42 "and points3D.txt files.")
43 ("copyImages", po::value<bool>(&copyImages)->default_value(copyImages),
44 "Copy original images to Colmap folder. This is required if your images are not all in the same "
45 "folder.");
46 // clang-format on
47
48 CmdLine cmdline("Export an AV SfMData to a Colmap scene, creating the folder structure and "
49 "the scene files that can be used for running a MVS step.\n"
50 "AliceVision exportColmap");
51 cmdline.add(requiredParams);
52 if (!cmdline.execute(argc, argv))
53 {
54 return EXIT_FAILURE;
55 }
56
57 if (!utils::exists(outDirectory))
58 {
59 fs::create_directory(outDirectory);
60 }
61
62 // Read the input SfM scene
63 sfmData::SfMData sfmData;
64 if (!sfmDataIO::load(sfmData, sfmDataFilename, sfmDataIO::ESfMData(sfmDataIO::ALL)))
65 {
66 ALICEVISION_LOG_ERROR("Unable to read the sfmdata file " << sfmDataFilename);
67 return EXIT_FAILURE;
68 }
69
70 sfmDataIO::convertToColmapScene(sfmData, outDirectory, copyImages);
71
72 return EXIT_SUCCESS;
73}

Callers

nothing calls this directly

Calls 6

existsFunction · 0.85
ESfMDataEnum · 0.85
convertToColmapSceneFunction · 0.85
executeMethod · 0.80
loadFunction · 0.50
addMethod · 0.45

Tested by

no test coverage detected