kopia lustrzana https://github.com/OpenDroneMap/ODM
Added automatic mesh resolution calculation
rodzic
18cb845957
commit
dc8ccfa0e7
|
@ -141,6 +141,11 @@ void Odm25dMeshing::buildMesh(){
|
||||||
double extentX = bounds[1] - bounds[0];
|
double extentX = bounds[1] - bounds[0];
|
||||||
double extentY = bounds[3] - bounds[2];
|
double extentY = bounds[3] - bounds[2];
|
||||||
|
|
||||||
|
if (resolution == 0.0){
|
||||||
|
resolution = (double)maxVertexCount / (sqrt(extentX * extentY) * 75.0);
|
||||||
|
log << "Automatically set resolution to " << std::fixed << resolution << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
int width = ceil(extentX * resolution);
|
int width = ceil(extentX * resolution);
|
||||||
int height = ceil(extentY * resolution);
|
int height = ceil(extentY * resolution);
|
||||||
|
|
||||||
|
@ -334,7 +339,7 @@ void Odm25dMeshing::parseArguments(int argc, char **argv) {
|
||||||
ss >> resolution;
|
ss >> resolution;
|
||||||
if (ss.bad()) throw Odm25dMeshingException("Argument '" + argument + "' has a bad value (wrong type).");
|
if (ss.bad()) throw Odm25dMeshingException("Argument '" + argument + "' has a bad value (wrong type).");
|
||||||
|
|
||||||
resolution = std::min<double>(100000, std::max<double>(resolution, 0.00001));
|
resolution = std::min<double>(100000, std::max<double>(resolution, 0));
|
||||||
log << "Resolution was manually set to: " << resolution << "\n";
|
log << "Resolution was manually set to: " << resolution << "\n";
|
||||||
} else if (argument == "-neighbors" && argIndex < argc) {
|
} else if (argument == "-neighbors" && argIndex < argc) {
|
||||||
++argIndex;
|
++argIndex;
|
||||||
|
@ -427,7 +432,7 @@ void Odm25dMeshing::printHelp() {
|
||||||
<< " -verbose whether to print verbose output (default: " << (printInCoutPop ? "true" : "false") << ")\n"
|
<< " -verbose whether to print verbose output (default: " << (printInCoutPop ? "true" : "false") << ")\n"
|
||||||
<< " -maxVertexCount <0 - N> Maximum number of vertices in the output mesh. The mesh might have fewer vertices, but will not exceed this limit. (default: " << maxVertexCount << ")\n"
|
<< " -maxVertexCount <0 - N> Maximum number of vertices in the output mesh. The mesh might have fewer vertices, but will not exceed this limit. (default: " << maxVertexCount << ")\n"
|
||||||
<< " -neighbors <1 - 1000> Number of nearest neighbors to consider when doing shepard's interpolation and outlier removal. Higher values lead to smoother meshes but take longer to process. (default: " << neighbors << ")\n"
|
<< " -neighbors <1 - 1000> Number of nearest neighbors to consider when doing shepard's interpolation and outlier removal. Higher values lead to smoother meshes but take longer to process. (default: " << neighbors << ")\n"
|
||||||
<< " -resolution <1 - N> Size of the interpolated digital surface model (DSM) used for deriving the 2.5D mesh, expressed in pixels per meter unit. (default: " << resolution << ")\n"
|
<< " -resolution <0 - N> Size of the interpolated digital surface model (DSM) used for deriving the 2.5D mesh, expressed in pixels per meter unit. When set to zero, the program automatically attempts to find a good value based on the point cloud extent and target vertex count. (default: " << resolution << ")\n"
|
||||||
|
|
||||||
<< "\n";
|
<< "\n";
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ private:
|
||||||
std::string outputFile = "odm_25dmesh.ply";
|
std::string outputFile = "odm_25dmesh.ply";
|
||||||
std::string logFilePath = "odm_25dmeshing_log.txt";
|
std::string logFilePath = "odm_25dmeshing_log.txt";
|
||||||
int maxVertexCount = 100000;
|
int maxVertexCount = 100000;
|
||||||
double resolution = 20.0;
|
double resolution = 0;
|
||||||
unsigned int neighbors = 24;
|
unsigned int neighbors = 24;
|
||||||
std::string outputDsmFile = "";
|
std::string outputDsmFile = "";
|
||||||
bool showDebugWindow = false;
|
bool showDebugWindow = false;
|
||||||
|
|
|
@ -258,12 +258,13 @@ def config():
|
||||||
|
|
||||||
parser.add_argument('--mesh-resolution',
|
parser.add_argument('--mesh-resolution',
|
||||||
metavar='<positive float>',
|
metavar='<positive float>',
|
||||||
default=10,
|
default=0,
|
||||||
type=float,
|
type=float,
|
||||||
help=('Size of the interpolated surface model used for deriving the 2.5D mesh, expressed in pixels per meter. '
|
help=('Size of the interpolated surface model used for deriving the 2.5D mesh, expressed in pixels per meter. '
|
||||||
'Higher values work better for complex or urban terrains. '
|
'Higher values work better for complex or urban terrains. '
|
||||||
'Lower values work better on flat areas. '
|
'Lower values work better on flat areas. '
|
||||||
'Resolution has no effect on the number of vertices, but high values can severely impact runtime speed and memory usage. '
|
'Resolution has no effect on the number of vertices, but high values can severely impact runtime speed and memory usage. '
|
||||||
|
'When set to zero, the program automatically attempts to find a good value based on the point cloud extent and target vertex count. '
|
||||||
'Applies to 2.5D mesh only. '
|
'Applies to 2.5D mesh only. '
|
||||||
'Default: %(default)s'))
|
'Default: %(default)s'))
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue