kopia lustrzana https://github.com/OpenDroneMap/ODM
rodzic
8165697ea9
commit
8c10c31d7a
|
@ -74,12 +74,22 @@ def dem_to_points(inGeotiff, outPointCloud, verbose=False):
|
|||
return outPointCloud
|
||||
|
||||
|
||||
def dem_to_mesh_gridded(inGeotiff, outPointCloud, maxVertexCount, verbose=False):
|
||||
def dem_to_mesh_gridded(inGeotiff, outMesh, maxVertexCount, verbose=False):
|
||||
log.ODM_INFO('Creating mesh from DSM: %s' % inGeotiff)
|
||||
|
||||
mesh_path, mesh_filename = os.path.split(outMesh)
|
||||
# mesh_path = path/to
|
||||
# mesh_filename = odm_mesh.ply
|
||||
|
||||
basename, ext = os.path.splitext(mesh_filename)
|
||||
# basename = odm_mesh
|
||||
# ext = .ply
|
||||
|
||||
outMeshDirty = os.path.join(mesh_path, "{}.dirty{}".format(basename, ext))
|
||||
|
||||
kwargs = {
|
||||
'bin': context.dem2mesh_path,
|
||||
'outfile': outPointCloud,
|
||||
'outfile': outMeshDirty,
|
||||
'infile': inGeotiff,
|
||||
'maxVertexCount': maxVertexCount,
|
||||
'verbose': '-verbose' if verbose else ''
|
||||
|
@ -90,7 +100,25 @@ def dem_to_mesh_gridded(inGeotiff, outPointCloud, maxVertexCount, verbose=False)
|
|||
'-maxVertexCount {maxVertexCount} '
|
||||
' {verbose} '.format(**kwargs))
|
||||
|
||||
return outPointCloud
|
||||
# Cleanup and reduce vertex count if necessary
|
||||
# (as dem2mesh cannot guarantee that we'll have the target vertex count)
|
||||
cleanupArgs = {
|
||||
'bin': context.odm_modules_path,
|
||||
'outfile': outMesh,
|
||||
'infile': outMeshDirty,
|
||||
'max_vertex': maxVertexCount,
|
||||
'verbose': '-verbose' if verbose else ''
|
||||
}
|
||||
|
||||
system.run('{bin}/odm_cleanmesh -inputFile {infile} '
|
||||
'-outputFile {outfile} '
|
||||
'-removeIslands '
|
||||
'-decimateMesh {max_vertex} {verbose} '.format(**cleanupArgs))
|
||||
|
||||
# Delete intermediate results
|
||||
os.remove(outMeshDirty)
|
||||
|
||||
return outMesh
|
||||
|
||||
|
||||
def screened_poisson_reconstruction(inPointCloud, outMesh, depth = 8, samples = 1, maxVertexCount=100000, pointWeight=4, threads=context.num_cores, verbose=False):
|
||||
|
|
Ładowanie…
Reference in New Issue