From ee2d82fdd8e109e43af0c8e5194d6db12c3f7b14 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Sat, 21 Nov 2020 13:21:10 -0500 Subject: [PATCH] Refactor optimize-disk-space fix --- stages/openmvs.py | 8 ++++---- stages/run_opensfm.py | 11 ++++++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/stages/openmvs.py b/stages/openmvs.py index 3c96660b..3f86f6ef 100644 --- a/stages/openmvs.py +++ b/stages/openmvs.py @@ -83,14 +83,14 @@ class ODMOpenMVSStage(types.ODM_Stage): if args.optimize_disk_space: files = [scene_dense, os.path.join(tree.openmvs, 'scene_dense.ply'), - os.path.join(tree.openmvs, 'scene_dense_dense_filtered.mvs')] + os.path.join(tree.openmvs, 'scene_dense_dense_filtered.mvs'), + octx.path("undistorted", "tracks.csv"), + octx.path("undistorted", "reconstruction.json") + ] for f in files: if os.path.exists(f): os.remove(f) shutil.rmtree(depthmaps_dir) - - os.remove(octx.path("undistorted", "tracks.csv")) - os.remove(octx.path("undistorted", "reconstruction.json")) else: log.ODM_WARNING('Found a valid OpenMVS reconstruction file in: %s' % tree.openmvs_model) diff --git a/stages/run_opensfm.py b/stages/run_opensfm.py index 69e99014..70072409 100644 --- a/stages/run_opensfm.py +++ b/stages/run_opensfm.py @@ -135,4 +135,13 @@ class ODMOpenSfMStage(types.ODM_Stage): if io.dir_exists(octx.path("undistorted", "depthmaps")): files = glob.glob(octx.path("undistorted", "depthmaps", "*.npz")) for f in files: - os.remove(f) \ No newline at end of file + os.remove(f) + + # Keep these if using OpenMVS + if args.fast_orthophoto or args.use_opensfm_dense: + files = [octx.path("undistorted", "tracks.csv"), + octx.path("undistorted", "reconstruction.json") + ] + for f in files: + if os.path.exists(f): + os.remove(f) \ No newline at end of file