Added automatic mesh resolution calculation

pull/736/head
Piero Toffanin 2018-01-12 12:25:44 -05:00
rodzic 18cb845957
commit dc8ccfa0e7
3 zmienionych plików z 10 dodań i 4 usunięć

Wyświetl plik

@ -141,6 +141,11 @@ void Odm25dMeshing::buildMesh(){
double extentX = bounds[1] - bounds[0];
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 height = ceil(extentY * resolution);
@ -334,7 +339,7 @@ void Odm25dMeshing::parseArguments(int argc, char **argv) {
ss >> resolution;
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";
} else if (argument == "-neighbors" && argIndex < argc) {
++argIndex;
@ -427,7 +432,7 @@ void Odm25dMeshing::printHelp() {
<< " -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"
<< " -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";

Wyświetl plik

@ -83,7 +83,7 @@ private:
std::string outputFile = "odm_25dmesh.ply";
std::string logFilePath = "odm_25dmeshing_log.txt";
int maxVertexCount = 100000;
double resolution = 20.0;
double resolution = 0;
unsigned int neighbors = 24;
std::string outputDsmFile = "";
bool showDebugWindow = false;

Wyświetl plik

@ -258,12 +258,13 @@ def config():
parser.add_argument('--mesh-resolution',
metavar='<positive float>',
default=10,
default=0,
type=float,
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. '
'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. '
'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. '
'Default: %(default)s'))