MCPcopy Create free account
hub / github.com/cdcseacave/openMVS / Initialize

Method Initialize

apps/ReconstructMesh/ReconstructMesh.cpp:95–219  ·  view source on GitHub ↗

initialize and parse the command line parameters

Source from the content-addressed store, hash-verified

93
94// initialize and parse the command line parameters
95bool Application::Initialize(size_t argc, LPCTSTR* argv)
96{
97 // initialize log and console
98 OPEN_LOG();
99 OPEN_LOGCONSOLE();
100
101 // group of options allowed only on command line
102 boost::program_options::options_description generic("Generic options");
103 generic.add_options()
104 ("help,h", "produce this help message")
105 ("working-folder,w", boost::program_options::value<std::string>(&WORKING_FOLDER), "working directory (default current directory)")
106 ("config-file,c", boost::program_options::value<std::string>(&OPT::strConfigFileName)->default_value(APPNAME _T(".cfg")), "file name containing program options")
107 ("export-type", boost::program_options::value<std::string>(&OPT::strExportType)->default_value(_T("ply")), "file type used to export the 3D scene (ply or obj)")
108 ("archive-type", boost::program_options::value(&OPT::nArchiveType)->default_value(ARCHIVE_MVS), "project archive type: -1-interface, 0-text, 1-binary, 2-compressed binary")
109 ("process-priority", boost::program_options::value(&OPT::nProcessPriority)->default_value(-1), "process priority (below normal by default)")
110 ("max-threads", boost::program_options::value(&OPT::nMaxThreads)->default_value(0), "maximum number of threads (0 for using all available cores)")
111 #if TD_VERBOSE != TD_VERBOSE_OFF
112 ("verbosity,v", boost::program_options::value(&g_nVerbosityLevel)->default_value(
113 #if TD_VERBOSE == TD_VERBOSE_DEBUG
114 3
115 #else
116 2
117 #endif
118 ), "verbosity level")
119 #endif
120 #ifdef _USE_CUDA
121 ("cuda-device", boost::program_options::value(&SEACAVE::CUDA::desiredDeviceID)->default_value(-1), "CUDA device number to be used to reconstruct the mesh (-2 - CPU processing, -1 - best GPU, >=0 - device index)")
122 #endif
123 ;
124
125 // group of options allowed both on command line and in config file
126 boost::program_options::options_description config_main("Reconstruct options");
127 config_main.add_options()
128 ("input-file,i", boost::program_options::value<std::string>(&OPT::strInputFileName), "input filename containing camera poses and image list")
129 ("pointcloud-file,p", boost::program_options::value<std::string>(&OPT::strPointCloudFileName), "dense point-cloud with views file name to reconstruct (overwrite existing point-cloud)")
130 ("output-file,o", boost::program_options::value<std::string>(&OPT::strOutputFileName), "output filename for storing the mesh")
131 ("min-point-distance,d", boost::program_options::value(&OPT::fDistInsert)->default_value(1.5f), "minimum distance in pixels between the projection of two 3D points to consider them different while triangulating (0 - disabled)")
132 ("integrate-only-roi", boost::program_options::value(&OPT::bUseOnlyROI)->default_value(false), "use only the points inside the ROI")
133 ("constant-weight", boost::program_options::value(&OPT::bUseConstantWeight)->default_value(true), "considers all view weights 1 instead of the available weight")
134 ("free-space-support,f", boost::program_options::value(&OPT::bUseFreeSpaceSupport)->default_value(false), "exploits the free-space support in order to reconstruct weakly-represented surfaces")
135 ("thickness-factor", boost::program_options::value(&OPT::fThicknessFactor)->default_value(1.f), "multiplier adjusting the minimum thickness considered during visibility weighting")
136 ("quality-factor", boost::program_options::value(&OPT::fQualityFactor)->default_value(1.f), "multiplier adjusting the quality weight considered during graph-cut")
137 ;
138 boost::program_options::options_description config_clean("Clean options");
139 config_clean.add_options()
140 ("decimate", boost::program_options::value(&OPT::fDecimateMesh)->default_value(1.f), "decimation factor in range (0..1] to be applied to the reconstructed surface (1 - disabled)")
141 ("target-face-num", boost::program_options::value(&OPT::nTargetFaceNum)->default_value(0), "target number of faces to be applied to the reconstructed surface. (0 - disabled)")
142 ("remove-spurious", boost::program_options::value(&OPT::fRemoveSpurious)->default_value(20.f), "spurious factor for removing faces with too long edges or isolated components (0 - disabled)")
143 ("remove-spikes", boost::program_options::value(&OPT::bRemoveSpikes)->default_value(true), "flag controlling the removal of spike faces")
144 ("close-holes", boost::program_options::value(&OPT::nCloseHoles)->default_value(30), "try to close small holes in the reconstructed surface (0 - disabled)")
145 ("smooth", boost::program_options::value(&OPT::nSmoothMesh)->default_value(2), "number of iterations to smooth the reconstructed surface (0 - disabled)")
146 ("edge-length", boost::program_options::value(&OPT::fEdgeLength)->default_value(0.f), "remesh such that the average edge length is this size (0 - disabled)")
147 ("roi-border", boost::program_options::value(&OPT::fBorderROI)->default_value(0), "add a border to the region-of-interest when cropping the scene (0 - disabled, >0 - percentage, <0 - absolute)")
148 ("crop-to-roi", boost::program_options::value(&OPT::bCrop2ROI)->default_value(true), "crop scene using the region-of-interest")
149 ;
150
151 // hidden options, allowed both on command line and
152 // in config file, but will not be shown to the user

Callers 1

mainFunction · 0.45

Calls 6

valueFunction · 0.85
CommandLineToStringFunction · 0.85
getFileFullNameFunction · 0.85
whatMethod · 0.80
addMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected