kopia lustrzana https://github.com/OpenDroneMap/ODM
Do not require lazrs on MacOS
rodzic
09bf59ab87
commit
759c2dbfba
|
@ -49,13 +49,27 @@ def classify(lasFile, scalar, slope, threshold, window):
|
|||
def rectify(lasFile, debug=False, reclassify_threshold=5, min_area=750, min_points=500):
|
||||
start = datetime.now()
|
||||
|
||||
pcFile = lasFile
|
||||
|
||||
try:
|
||||
# Workaround for MacOS: laspy does not have support for LAZ on macOS
|
||||
# so we first convert to normal LAS via PDAL
|
||||
# TODO: remove LASPY and use PDAL instead
|
||||
if sys.platform == 'darwin' and lasFile[-3:] == "laz":
|
||||
pcFile = lasFile + ".tmp.las"
|
||||
pdal.translate(lasFile, pcFile)
|
||||
|
||||
log.ODM_INFO("Rectifying {} using with [reclassify threshold: {}, min area: {}, min points: {}]".format(lasFile, reclassify_threshold, min_area, min_points))
|
||||
run_rectification(
|
||||
input=lasFile, output=lasFile, debug=debug, \
|
||||
input=pcFile, output=pcFile, debug=debug, \
|
||||
reclassify_plan='median', reclassify_threshold=reclassify_threshold, \
|
||||
extend_plan='surrounding', extend_grid_distance=5, \
|
||||
min_area=min_area, min_points=min_points)
|
||||
|
||||
if sys.platform == 'darwin' and pcFile != lasFile and os.path.isfile(pcFile):
|
||||
pdal.translate(pcFile, lasFile)
|
||||
os.remove(pcFile)
|
||||
|
||||
log.ODM_INFO('Created %s in %s' % (lasFile, datetime.now() - start))
|
||||
except Exception as e:
|
||||
log.ODM_WARNING("Error rectifying ground in file %s: %s" % (lasFile, str(e)))
|
||||
|
|
|
@ -168,6 +168,7 @@ def run_pdaltranslate_smrf(fin, fout, scalar, slope, threshold, window):
|
|||
|
||||
system.run(' '.join(cmd))
|
||||
|
||||
|
||||
def merge_point_clouds(input_files, output_file):
|
||||
if len(input_files) == 0:
|
||||
log.ODM_WARNING("Cannot merge point clouds, no point clouds to merge.")
|
||||
|
@ -181,3 +182,13 @@ def merge_point_clouds(input_files, output_file):
|
|||
|
||||
system.run(' '.join(cmd))
|
||||
|
||||
|
||||
def translate(input, output):
|
||||
cmd = [
|
||||
'pdal',
|
||||
'translate',
|
||||
'-i "%s"' % input,
|
||||
'-o "%s"' % output,
|
||||
]
|
||||
|
||||
system.run(' '.join(cmd))
|
|
@ -7,7 +7,8 @@ ODMExifRead==3.0.4
|
|||
Fiona==1.8.17 ; sys_platform == 'linux' or sys_platform == 'darwin'
|
||||
https://github.com/OpenDroneMap/windows-deps/raw/main/Fiona-1.8.19-cp38-cp38-win_amd64.whl ; sys_platform == 'win32'
|
||||
joblib==1.1.0
|
||||
laspy[lazrs]==2.3.0
|
||||
laspy[lazrs]==2.3.0 ; sys_platform == 'linux' or sys_platform == 'win32'
|
||||
laspy==2.3.0 ; sys_platform == 'darwin'
|
||||
lxml==4.6.1
|
||||
matplotlib==3.3.3
|
||||
networkx==2.5
|
||||
|
|
Ładowanie…
Reference in New Issue