kopia lustrzana https://github.com/OpenDroneMap/ODM
Update poissonrecon, add retries
rodzic
74a35035c7
commit
084038543e
|
@ -169,7 +169,7 @@ else()
|
|||
endif()
|
||||
externalproject_add(poissonrecon
|
||||
GIT_REPOSITORY https://github.com/OpenDroneMap/PoissonRecon.git
|
||||
GIT_TAG 250
|
||||
GIT_TAG 257
|
||||
PREFIX ${SB_BINARY_DIR}/PoissonRecon
|
||||
SOURCE_DIR ${SB_SOURCE_DIR}/PoissonRecon
|
||||
UPDATE_COMMAND ""
|
||||
|
|
|
@ -4,6 +4,7 @@ from opendm.dem import commands
|
|||
from opendm import system
|
||||
from opendm import log
|
||||
from opendm import context
|
||||
from opendm import concurrency
|
||||
from scipy import signal
|
||||
import numpy as np
|
||||
|
||||
|
@ -145,33 +146,52 @@ def screened_poisson_reconstruction(inPointCloud, outMesh, depth = 8, samples =
|
|||
# ext = .ply
|
||||
|
||||
outMeshDirty = os.path.join(mesh_path, "{}.dirty{}".format(basename, ext))
|
||||
if os.path.isfile(outMeshDirty):
|
||||
os.remove(outMeshDirty)
|
||||
|
||||
# Since PoissonRecon has some kind of a race condition on ppc64el, and this helps...
|
||||
if platform.machine() == 'ppc64le':
|
||||
log.ODM_WARNING("ppc64le platform detected, forcing single-threaded operation for PoissonRecon")
|
||||
threads = 1
|
||||
|
||||
poissonReconArgs = {
|
||||
'bin': context.poisson_recon_path,
|
||||
'outfile': outMeshDirty,
|
||||
'infile': inPointCloud,
|
||||
'depth': depth,
|
||||
'samples': samples,
|
||||
'pointWeight': pointWeight,
|
||||
'threads': threads,
|
||||
'verbose': '--verbose' if verbose else ''
|
||||
}
|
||||
|
||||
# Run PoissonRecon
|
||||
system.run('"{bin}" --in "{infile}" '
|
||||
'--out "{outfile}" '
|
||||
'--depth {depth} '
|
||||
'--pointWeight {pointWeight} '
|
||||
'--samplesPerNode {samples} '
|
||||
'--threads {threads} '
|
||||
'--bType 2 '
|
||||
'--linearFit '
|
||||
'{verbose}'.format(**poissonReconArgs))
|
||||
while True:
|
||||
poissonReconArgs = {
|
||||
'bin': context.poisson_recon_path,
|
||||
'outfile': outMeshDirty,
|
||||
'infile': inPointCloud,
|
||||
'depth': depth,
|
||||
'samples': samples,
|
||||
'pointWeight': pointWeight,
|
||||
'threads': int(threads),
|
||||
'memory': int(concurrency.get_max_memory_mb(4, 0.8) // 1024),
|
||||
'verbose': '--verbose' if verbose else ''
|
||||
}
|
||||
|
||||
# Run PoissonRecon
|
||||
system.run('"{bin}" --in "{infile}" '
|
||||
'--out "{outfile}" '
|
||||
'--depth {depth} '
|
||||
'--pointWeight {pointWeight} '
|
||||
'--samplesPerNode {samples} '
|
||||
'--threads {threads} '
|
||||
'--maxMemory {memory} '
|
||||
'--bType 2 '
|
||||
'--linearFit '
|
||||
'{verbose}'.format(**poissonReconArgs))
|
||||
|
||||
if os.path.isfile(outMeshDirty):
|
||||
break # Done!
|
||||
else:
|
||||
|
||||
# PoissonRecon will sometimes fail due to race conditions
|
||||
# on certain machines, especially on Windows
|
||||
threads //= 2
|
||||
|
||||
if threads < 1:
|
||||
break
|
||||
else:
|
||||
log.ODM_WARNING("PoissonRecon failed with %s threads, let's retry with %s..." % (threads, threads // 2))
|
||||
|
||||
|
||||
# Cleanup and reduce vertex count if necessary
|
||||
cleanupArgs = {
|
||||
|
|
Ładowanie…
Reference in New Issue