From 7cd63f87df12a012689c087ba99ac10579c27327 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Fri, 30 Apr 2021 15:45:48 -0400 Subject: [PATCH] ODM win32 smoke test! --- console.bat | 8 ++++++++ opendm/context.py | 11 ----------- opendm/log.py | 25 ++++++++++++++++++------- run.bat | 11 +++++++++++ stages/dataset.py | 4 ++++ win32env.bat | 6 ++++++ 6 files changed, 47 insertions(+), 18 deletions(-) create mode 100644 console.bat create mode 100644 run.bat create mode 100644 win32env.bat diff --git a/console.bat b/console.bat new file mode 100644 index 00000000..ca5a3f83 --- /dev/null +++ b/console.bat @@ -0,0 +1,8 @@ +@echo off + +setlocal +call win32env.bat + +start "ODM Console" cmd "/k venv\Scripts\activate" + +endlocal diff --git a/opendm/context.py b/opendm/context.py index 8f7900e9..efc929e4 100644 --- a/opendm/context.py +++ b/opendm/context.py @@ -33,18 +33,7 @@ mvstex_path = os.path.join(superbuild_bin_path, "texrecon") omvs_densify_path = os.path.join(superbuild_bin_path, "OpenMVS", "DensifyPointCloud") omvs_reconstructmesh_path = os.path.join(superbuild_bin_path, "OpenMVS", "ReconstructMesh") -<<<<<<< HEAD -======= -# define txt2las path -txt2las_path = os.path.join(superbuild_path, 'src/las-tools/bin') -pdal_path = os.path.join(superbuild_path, 'build/pdal/bin') - -# define odm modules path -odm_modules_path = os.path.join(root_path, "build/bin") -odm_modules_src_path = os.path.join(root_path, "modules") - odm_orthophoto_path = os.path.join(superbuild_bin_path, "odm_orthophoto") ->>>>>>> piero/omvsup settings_path = os.path.join(root_path, 'settings.yaml') # Define supported image extensions diff --git a/opendm/log.py b/opendm/log.py index 962f9265..c5a0299f 100644 --- a/opendm/log.py +++ b/opendm/log.py @@ -1,11 +1,22 @@ import sys -HEADER = '\033[95m' -OKBLUE = '\033[94m' -OKGREEN = '\033[92m' -DEFAULT = '\033[39m' -WARNING = '\033[93m' -FAIL = '\033[91m' -ENDC = '\033[0m' + +if sys.platform == 'win32': + # No colors on Windows, sorry! + HEADER = '' + OKBLUE = '' + OKGREEN = '' + DEFAULT = '' + WARNING = '' + FAIL = '' + ENDC = '' +else: + HEADER = '\033[95m' + OKBLUE = '\033[94m' + OKGREEN = '\033[92m' + DEFAULT = '\033[39m' + WARNING = '\033[93m' + FAIL = '\033[91m' + ENDC = '\033[0m' # logging has too many quirks... class ODMLogger: diff --git a/run.bat b/run.bat new file mode 100644 index 00000000..276347f0 --- /dev/null +++ b/run.bat @@ -0,0 +1,11 @@ +@echo off + +setlocal + +call win32env.bat +call %ODMBASE%\venv\Scripts\activate + +python "%ODMBASE%\run.py" %* + +endlocal + diff --git a/stages/dataset.py b/stages/dataset.py index ae503e07..268efd83 100644 --- a/stages/dataset.py +++ b/stages/dataset.py @@ -90,6 +90,10 @@ class ODMLoadDatasetStage(types.ODM_Stage): # check if we rerun cell or not images_database_file = os.path.join(tree.root_path, 'images.json') if not io.file_exists(images_database_file) or self.rerun(): + if not os.path.exists(images_dir): + log.ODM_ERROR("There are no images in %s! Make sure that your project path and dataset name is correct. The current is set to: %s" % (images_dir, args.project_path)) + exit(1) + files, rejects = get_images(images_dir) if files: # create ODMPhoto list diff --git a/win32env.bat b/win32env.bat new file mode 100644 index 00000000..d9af62b0 --- /dev/null +++ b/win32env.bat @@ -0,0 +1,6 @@ +set ODMBASE=%~dp0 +set GDALBASE=%ODMBASE%venv\Lib\site-packages\osgeo +set OSFMBASE=%ODMBASE%SuperBuild\install\bin\opensfm\bin + +set PATH=%GDALBASE%;%ODMBASE%SuperBuild\install\bin;%OSFMBASE% +set PROJ_LIB=%GDALBASE%\data\proj