1+ // This file is part of the AliceVision project.
2+ // Copyright (c) 2024 AliceVision contributors.
3+ // This Source Code Form is subject to the terms of the Mozilla Public License,
4+ // v. 2.0. If a copy of the MPL was not distributed with this file,
5+ // You can obtain one at https://mozilla.org/MPL/2.0/.
6+
7+ #include < aliceVision/types.hpp>
8+ #include < aliceVision/config.hpp>
9+
10+ #include < aliceVision/system/Timer.hpp>
11+ #include < aliceVision/system/Logger.hpp>
12+ #include < aliceVision/system/main.hpp>
13+ #include < aliceVision/cmdline/cmdline.hpp>
14+
15+ #include < aliceVision/sfmDataIO/sfmDataIO.hpp>
16+ #include < aliceVision/sfmData/colorize.hpp>
17+
18+ #include < boost/program_options.hpp>
19+ #include < boost/json.hpp>
20+
21+ // These constants define the current software version.
22+ // They must be updated when the command line is changed.
23+ #define ALICEVISION_SOFTWARE_VERSION_MAJOR 1
24+ #define ALICEVISION_SOFTWARE_VERSION_MINOR 0
25+
26+ using namespace aliceVision ;
27+ namespace po = boost::program_options;
28+
29+ int aliceVision_main (int argc, char ** argv)
30+ {
31+ // command-line parameters
32+ std::string sfmDataFilename;
33+ std::string sfmDataOutputFilename;
34+ // clang-format off
35+ po::options_description requiredParams (" Required parameters" );
36+ requiredParams.add_options ()
37+ (" input,i" , po::value<std::string>(&sfmDataFilename)->required (),
38+ " Input SfMData file." )
39+ (" output,o" , po::value<std::string>(&sfmDataOutputFilename)->required (),
40+ " SfMData output file with the injected poses." );
41+ // clang-format on
42+
43+ CmdLine cmdline (" AliceVision SfM Colorizing" );
44+
45+ cmdline.add (requiredParams);
46+ if (!cmdline.execute (argc, argv))
47+ {
48+ return EXIT_FAILURE;
49+ }
50+
51+ // Set maxThreads
52+ HardwareContext hwc = cmdline.getHardwareContext ();
53+ omp_set_num_threads (hwc.getMaxThreads ());
54+
55+ // Load input SfMData scene
56+ sfmData::SfMData sfmData;
57+ if (!sfmDataIO::load (sfmData, sfmDataFilename, sfmDataIO::ESfMData::ALL))
58+ {
59+ ALICEVISION_LOG_ERROR (" The input SfMData file '" + sfmDataFilename + " ' cannot be read." );
60+ return EXIT_FAILURE;
61+ }
62+
63+ sfmData::colorizeTracks (sfmData);
64+
65+ sfmDataIO::save (sfmData, sfmDataOutputFilename, sfmDataIO::ESfMData::ALL);
66+
67+ return EXIT_SUCCESS;
68+ }
0 commit comments