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 SOURCE_DIR ${SB_SOURCE_DIR}/dem2mesh
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${SB_INSTALL_DIR} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${SB_INSTALL_DIR}
${WIN32_GDAL_ARGS} ${WIN32_GDAL_ARGS}
UPDATE_COMMAND ""
BUILD_IN_SOURCE 1
INSTALL_COMMAND ""
) )
externalproject_add(dem2points externalproject_add(dem2points

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -24,8 +24,9 @@ class OSFMContext:
self.opensfm_project_path = opensfm_project_path self.opensfm_project_path = opensfm_project_path
def run(self, command): def run(self, command):
system.run('%s/bin/opensfm %s "%s"' % osfm_bin = os.path.join(context.opensfm_path, 'bin', 'opensfm')
(context.opensfm_path, command, self.opensfm_project_path)) system.run('%s %s "%s"' %
(osfm_bin, command, self.opensfm_project_path))
def is_reconstruction_done(self): def is_reconstruction_done(self):
tracks_file = os.path.join(self.opensfm_project_path, 'tracks.csv') 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"): if filename_template.endswith(".ply"):
cmd += ("--writers.ply.sized_types=false " cmd += ("--writers.ply.sized_types=false "
"--writers.ply.storage_mode='little endian' ") "--writers.ply.storage_mode=\"little endian\" ")
if dims is not None: if dims is not None:
cmd += '--writers.ply.dims="%s"' % dims cmd += '--writers.ply.dims="%s"' % dims
system.run(cmd) system.run(cmd)
@ -151,7 +151,7 @@ def filter(input_point_cloud, output_point_cloud, standard_deviation=2.5, meank=
"-o \"{outputFile}\" " "-o \"{outputFile}\" "
"{stages} " "{stages} "
"--writers.ply.sized_types=false " "--writers.ply.sized_types=false "
"--writers.ply.storage_mode='little endian' " "--writers.ply.storage_mode=\"little endian\" "
"--writers.ply.dims=\"{dims}\" " "--writers.ply.dims=\"{dims}\" "
"").format(**filterArgs) "").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) cmd += "--filters.sample.radius={} ".format(sample_radius)
if 'outlier' in filters: if 'outlier' in filters:
cmd += ("--filters.outlier.method='statistical' " cmd += ("--filters.outlier.method=\"statistical\" "
"--filters.outlier.mean_k={} " "--filters.outlier.mean_k={} "
"--filters.outlier.multiplier={} ").format(meank, standard_deviation) "--filters.outlier.multiplier={} ").format(meank, standard_deviation)
if 'range' in filters: if 'range' in filters:
# Remove outliers # Remove outliers
cmd += "--filters.range.limits='Classification![7:7]' " cmd += "--filters.range.limits=\"Classification![7:7]\" "
system.run(cmd) 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: for k in env_vars:
env[k] = str(env_vars[k]) 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) running_subprocesses.append(p)
retcode = p.wait() retcode = p.wait()
running_subprocesses.remove(p) running_subprocesses.remove(p)

Wyświetl plik

@ -70,7 +70,7 @@ class ODMOpenSfMStage(types.ODM_Stage):
geocoords_flag_file = octx.path("exported_geocoords.txt") geocoords_flag_file = octx.path("exported_geocoords.txt")
if reconstruction.is_georeferenced() and (not io.file_exists(geocoords_flag_file) or self.rerun()): 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)) (reconstruction.georef.proj4(), reconstruction.georef.utm_east_offset, reconstruction.georef.utm_north_offset))
# Destructive # Destructive
shutil.move(tree.opensfm_geocoords_reconstruction, tree.opensfm_reconstruction) shutil.move(tree.opensfm_geocoords_reconstruction, tree.opensfm_reconstruction)