Windows fixes up to meshing

pull/1283/head
Piero Toffanin 2021-05-04 13:04:13 -04:00
rodzic e914800fb1
commit 5ef0e7c129
7 zmienionych plików z 20 dodań i 20 usunięć

Wyświetl plik

@ -186,9 +186,6 @@ externalproject_add(dem2mesh
SOURCE_DIR ${SB_SOURCE_DIR}/dem2mesh
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${SB_INSTALL_DIR}
${WIN32_GDAL_ARGS}
UPDATE_COMMAND ""
BUILD_IN_SOURCE 1
INSTALL_COMMAND ""
)
externalproject_add(dem2points

Wyświetl plik

@ -12,6 +12,7 @@ from opendm import system
from opendm.concurrency import get_max_memory, parallel_map
from scipy import ndimage
from datetime import datetime
from osgeo.utils.gdal_fillnodata import main as gdal_fillnodata
from opendm import log
try:
import Queue as queue
@ -227,14 +228,14 @@ def create_dem(input_point_cloud, dem_type, output_type='max', radiuses=['0.56']
'{geotiff_tmp} {geotiff_small}'.format(**kwargs))
# Fill scaled
run('gdal_fillnodata.py '
'-co NUM_THREADS={threads} '
'-co BIGTIFF=IF_SAFER '
'--config GDAL_CACHEMAX {max_memory}% '
'-b 1 '
'-of GTiff '
'{geotiff_small} {geotiff_small_filled}'.format(**kwargs))
gdal_fillnodata(['.',
'-co', 'NUM_THREADS=%s' % kwargs['threads'],
'-co', 'BIGTIFF=IF_SAFER',
'--config', 'GDAL_CACHE_MAX', str(kwargs['max_memory']) + '%',
'-b', '1',
'-of', 'GTiff',
kwargs['geotiff_small'], kwargs['geotiff_small_filled']])
# Merge filled scaled DEM with unfilled DEM using bilinear interpolation
run('gdalbuildvrt -resolution highest -r bilinear "%s" "%s" "%s"' % (merged_vrt_path, geotiff_small_filled_path, geotiff_tmp_path))
run('gdal_translate '

Wyświetl plik

@ -31,6 +31,7 @@
# Library functions for creating DEMs from Lidar data
import os
import sys
import json as jsonlib
import tempfile
from opendm import system
@ -156,7 +157,7 @@ def run_pipeline(json, verbose=False):
'pipeline',
'-i %s' % jsonfile
]
if verbose:
if verbose or sys.platform == 'win32':
system.run(' '.join(cmd))
else:
system.run(' '.join(cmd) + ' > /dev/null 2>&1')

Wyświetl plik

@ -24,8 +24,9 @@ class OSFMContext:
self.opensfm_project_path = opensfm_project_path
def run(self, command):
system.run('%s/bin/opensfm %s "%s"' %
(context.opensfm_path, command, self.opensfm_project_path))
osfm_bin = os.path.join(context.opensfm_path, 'bin', 'opensfm')
system.run('%s %s "%s"' %
(osfm_bin, command, self.opensfm_project_path))
def is_reconstruction_done(self):
tracks_file = os.path.join(self.opensfm_project_path, 'tracks.csv')

Wyświetl plik

@ -60,7 +60,7 @@ def split(input_point_cloud, outdir, filename_template, capacity, dims=None):
if filename_template.endswith(".ply"):
cmd += ("--writers.ply.sized_types=false "
"--writers.ply.storage_mode='little endian' ")
"--writers.ply.storage_mode=\"little endian\" ")
if dims is not None:
cmd += '--writers.ply.dims="%s"' % dims
system.run(cmd)
@ -151,7 +151,7 @@ def filter(input_point_cloud, output_point_cloud, standard_deviation=2.5, meank=
"-o \"{outputFile}\" "
"{stages} "
"--writers.ply.sized_types=false "
"--writers.ply.storage_mode='little endian' "
"--writers.ply.storage_mode=\"little endian\" "
"--writers.ply.dims=\"{dims}\" "
"").format(**filterArgs)
@ -159,13 +159,13 @@ def filter(input_point_cloud, output_point_cloud, standard_deviation=2.5, meank=
cmd += "--filters.sample.radius={} ".format(sample_radius)
if 'outlier' in filters:
cmd += ("--filters.outlier.method='statistical' "
cmd += ("--filters.outlier.method=\"statistical\" "
"--filters.outlier.mean_k={} "
"--filters.outlier.multiplier={} ").format(meank, standard_deviation)
if 'range' in filters:
# Remove outliers
cmd += "--filters.range.limits='Classification![7:7]' "
cmd += "--filters.range.limits=\"Classification![7:7]\" "
system.run(cmd)

Wyświetl plik

@ -72,7 +72,7 @@ def run(cmd, env_paths=[context.superbuild_bin_path], env_vars={}, packages_path
for k in env_vars:
env[k] = str(env_vars[k])
p = subprocess.Popen(cmd, shell=True, env=env, preexec_fn=os.setsid)
p = subprocess.Popen(cmd, shell=True, env=env, start_new_session=True)
running_subprocesses.append(p)
retcode = p.wait()
running_subprocesses.remove(p)

Wyświetl plik

@ -70,7 +70,7 @@ class ODMOpenSfMStage(types.ODM_Stage):
geocoords_flag_file = octx.path("exported_geocoords.txt")
if reconstruction.is_georeferenced() and (not io.file_exists(geocoords_flag_file) or self.rerun()):
octx.run('export_geocoords --reconstruction --proj \'%s\' --offset-x %s --offset-y %s' %
octx.run('export_geocoords --reconstruction --proj "%s" --offset-x %s --offset-y %s' %
(reconstruction.georef.proj4(), reconstruction.georef.utm_east_offset, reconstruction.georef.utm_north_offset))
# Destructive
shutil.move(tree.opensfm_geocoords_reconstruction, tree.opensfm_reconstruction)