diff --git a/opendm/config.py b/opendm/config.py index 903a62c6..b31246e6 100755 --- a/opendm/config.py +++ b/opendm/config.py @@ -5,7 +5,7 @@ from opendm import io from opendm import log from appsettings import SettingsParser from pyodm import Node, exceptions - +import os import sys # parse arguments @@ -13,7 +13,7 @@ processopts = ['dataset', 'split', 'merge', 'opensfm', 'mve', 'odm_filterpoints' 'odm_meshing', 'mvs_texturing', 'odm_georeferencing', 'odm_dem', 'odm_orthophoto', 'odm_report'] -with open(io.join_paths(context.root_path, 'VERSION')) as version_file: +with open(os.path.join(context.root_path, 'VERSION')) as version_file: __version__ = version_file.read().strip() diff --git a/opendm/osfm.py b/opendm/osfm.py index a6802c81..467d7bbf 100644 --- a/opendm/osfm.py +++ b/opendm/osfm.py @@ -62,7 +62,7 @@ class OSFMContext: if not io.dir_exists(self.opensfm_project_path): system.mkdir_p(self.opensfm_project_path) - list_path = io.join_paths(self.opensfm_project_path, 'image_list.txt') + list_path = os.path.join(self.opensfm_project_path, 'image_list.txt') if not io.file_exists(list_path) or rerun: # create file list @@ -74,7 +74,7 @@ class OSFMContext: has_alt = False if photo.latitude is not None and photo.longitude is not None: has_gps = True - fout.write('%s\n' % io.join_paths(images_path, photo.filename)) + fout.write('%s\n' % os.path.join(images_path, photo.filename)) # check for image_groups.txt (split-merge) image_groups_file = os.path.join(args.project_path, "image_groups.txt") @@ -244,7 +244,7 @@ class OSFMContext: log.ODM_WARNING("%s already exists, not rerunning OpenSfM setup" % list_path) def get_config_file_path(self): - return io.join_paths(self.opensfm_project_path, 'config.yaml') + return os.path.join(self.opensfm_project_path, 'config.yaml') def reconstructed(self): if not io.file_exists(self.path("reconstruction.json")): diff --git a/opendm/types.py b/opendm/types.py index 341aa5ab..933a9b48 100644 --- a/opendm/types.py +++ b/opendm/types.py @@ -204,57 +204,57 @@ class ODM_Tree(object): def __init__(self, root_path, gcp_file = None, geo_file = None): # root path to the project self.root_path = io.absolute_path_file(root_path) - self.input_images = io.join_paths(self.root_path, 'images') + self.input_images = os.path.join(self.root_path, 'images') # modules paths # here are defined where all modules should be located in # order to keep track all files al directories during the # whole reconstruction process. - self.dataset_raw = io.join_paths(self.root_path, 'images') - self.opensfm = io.join_paths(self.root_path, 'opensfm') - self.mve = io.join_paths(self.root_path, 'mve') - self.odm_meshing = io.join_paths(self.root_path, 'odm_meshing') - self.odm_texturing = io.join_paths(self.root_path, 'odm_texturing') - self.odm_25dtexturing = io.join_paths(self.root_path, 'odm_texturing_25d') - self.odm_georeferencing = io.join_paths(self.root_path, 'odm_georeferencing') - self.odm_25dgeoreferencing = io.join_paths(self.root_path, 'odm_georeferencing_25d') - self.odm_filterpoints = io.join_paths(self.root_path, 'odm_filterpoints') - self.odm_orthophoto = io.join_paths(self.root_path, 'odm_orthophoto') - self.odm_report = io.join_paths(self.root_path, 'odm_report') + self.dataset_raw = os.path.join(self.root_path, 'images') + self.opensfm = os.path.join(self.root_path, 'opensfm') + self.mve = os.path.join(self.root_path, 'mve') + self.odm_meshing = os.path.join(self.root_path, 'odm_meshing') + self.odm_texturing = os.path.join(self.root_path, 'odm_texturing') + self.odm_25dtexturing = os.path.join(self.root_path, 'odm_texturing_25d') + self.odm_georeferencing = os.path.join(self.root_path, 'odm_georeferencing') + self.odm_25dgeoreferencing = os.path.join(self.root_path, 'odm_georeferencing_25d') + self.odm_filterpoints = os.path.join(self.root_path, 'odm_filterpoints') + self.odm_orthophoto = os.path.join(self.root_path, 'odm_orthophoto') + self.odm_report = os.path.join(self.root_path, 'odm_report') # important files paths # benchmarking - self.benchmarking = io.join_paths(self.root_path, 'benchmark.txt') - self.dataset_list = io.join_paths(self.root_path, 'img_list.txt') + self.benchmarking = os.path.join(self.root_path, 'benchmark.txt') + self.dataset_list = os.path.join(self.root_path, 'img_list.txt') # opensfm - self.opensfm_tracks = io.join_paths(self.opensfm, 'tracks.csv') - self.opensfm_bundle = io.join_paths(self.opensfm, 'bundle_r000.out') - self.opensfm_bundle_list = io.join_paths(self.opensfm, 'list_r000.out') - self.opensfm_image_list = io.join_paths(self.opensfm, 'image_list.txt') - self.opensfm_reconstruction = io.join_paths(self.opensfm, 'reconstruction.json') - self.opensfm_reconstruction_nvm = io.join_paths(self.opensfm, 'undistorted/reconstruction.nvm') - self.opensfm_model = io.join_paths(self.opensfm, 'undistorted/depthmaps/merged.ply') - self.opensfm_transformation = io.join_paths(self.opensfm, 'geocoords_transformation.txt') + self.opensfm_tracks = os.path.join(self.opensfm, 'tracks.csv') + self.opensfm_bundle = os.path.join(self.opensfm, 'bundle_r000.out') + self.opensfm_bundle_list = os.path.join(self.opensfm, 'list_r000.out') + self.opensfm_image_list = os.path.join(self.opensfm, 'image_list.txt') + self.opensfm_reconstruction = os.path.join(self.opensfm, 'reconstruction.json') + self.opensfm_reconstruction_nvm = os.path.join(self.opensfm, 'undistorted/reconstruction.nvm') + self.opensfm_model = os.path.join(self.opensfm, 'undistorted/depthmaps/merged.ply') + self.opensfm_transformation = os.path.join(self.opensfm, 'geocoords_transformation.txt') # mve - self.mve_model = io.join_paths(self.mve, 'mve_dense_point_cloud.ply') - self.mve_views = io.join_paths(self.mve, 'views') + self.mve_model = os.path.join(self.mve, 'mve_dense_point_cloud.ply') + self.mve_views = os.path.join(self.mve, 'views') # filter points - self.filtered_point_cloud = io.join_paths(self.odm_filterpoints, "point_cloud.ply") + self.filtered_point_cloud = os.path.join(self.odm_filterpoints, "point_cloud.ply") # odm_meshing - self.odm_mesh = io.join_paths(self.odm_meshing, 'odm_mesh.ply') - self.odm_meshing_log = io.join_paths(self.odm_meshing, 'odm_meshing_log.txt') - self.odm_25dmesh = io.join_paths(self.odm_meshing, 'odm_25dmesh.ply') - self.odm_25dmeshing_log = io.join_paths(self.odm_meshing, 'odm_25dmeshing_log.txt') + self.odm_mesh = os.path.join(self.odm_meshing, 'odm_mesh.ply') + self.odm_meshing_log = os.path.join(self.odm_meshing, 'odm_meshing_log.txt') + self.odm_25dmesh = os.path.join(self.odm_meshing, 'odm_25dmesh.ply') + self.odm_25dmeshing_log = os.path.join(self.odm_meshing, 'odm_25dmeshing_log.txt') # texturing - self.odm_texturing_undistorted_image_path = io.join_paths( + self.odm_texturing_undistorted_image_path = os.path.join( self.odm_texturing, 'undistorted') self.odm_textured_model_obj = 'odm_textured_model.obj' self.odm_textured_model_mtl = 'odm_textured_model.mtl' @@ -262,42 +262,42 @@ class ODM_Tree(object): self.odm_texuring_log = 'odm_texturing_log.txt' # odm_georeferencing - self.odm_georeferencing_coords = io.join_paths( + self.odm_georeferencing_coords = os.path.join( self.odm_georeferencing, 'coords.txt') self.odm_georeferencing_gcp = gcp_file or io.find('gcp_list.txt', self.root_path) - self.odm_georeferencing_gcp_utm = io.join_paths(self.odm_georeferencing, 'gcp_list_utm.txt') + self.odm_georeferencing_gcp_utm = os.path.join(self.odm_georeferencing, 'gcp_list_utm.txt') self.odm_geo_file = geo_file or io.find('geo.txt', self.root_path) - self.odm_georeferencing_utm_log = io.join_paths( + self.odm_georeferencing_utm_log = os.path.join( self.odm_georeferencing, 'odm_georeferencing_utm_log.txt') self.odm_georeferencing_log = 'odm_georeferencing_log.txt' self.odm_georeferencing_transform_file = 'odm_georeferencing_transform.txt' self.odm_georeferencing_proj = 'proj.txt' self.odm_georeferencing_model_txt_geo = 'odm_georeferencing_model_geo.txt' self.odm_georeferencing_model_obj_geo = 'odm_textured_model_geo.obj' - self.odm_georeferencing_xyz_file = io.join_paths( + self.odm_georeferencing_xyz_file = os.path.join( self.odm_georeferencing, 'odm_georeferenced_model.csv') - self.odm_georeferencing_las_json = io.join_paths( + self.odm_georeferencing_las_json = os.path.join( self.odm_georeferencing, 'las.json') - self.odm_georeferencing_model_laz = io.join_paths( + self.odm_georeferencing_model_laz = os.path.join( self.odm_georeferencing, 'odm_georeferenced_model.laz') - self.odm_georeferencing_model_las = io.join_paths( + self.odm_georeferencing_model_las = os.path.join( self.odm_georeferencing, 'odm_georeferenced_model.las') - self.odm_georeferencing_dem = io.join_paths( + self.odm_georeferencing_dem = os.path.join( self.odm_georeferencing, 'odm_georeferencing_model_dem.tif') # odm_orthophoto - self.odm_orthophoto_render = io.join_paths(self.odm_orthophoto, 'odm_orthophoto_render.tif') - self.odm_orthophoto_tif = io.join_paths(self.odm_orthophoto, 'odm_orthophoto.tif') - self.odm_orthophoto_corners = io.join_paths(self.odm_orthophoto, 'odm_orthophoto_corners.txt') - self.odm_orthophoto_log = io.join_paths(self.odm_orthophoto, 'odm_orthophoto_log.txt') - self.odm_orthophoto_tif_log = io.join_paths(self.odm_orthophoto, 'gdal_translate_log.txt') + self.odm_orthophoto_render = os.path.join(self.odm_orthophoto, 'odm_orthophoto_render.tif') + self.odm_orthophoto_tif = os.path.join(self.odm_orthophoto, 'odm_orthophoto.tif') + self.odm_orthophoto_corners = os.path.join(self.odm_orthophoto, 'odm_orthophoto_corners.txt') + self.odm_orthophoto_log = os.path.join(self.odm_orthophoto, 'odm_orthophoto_log.txt') + self.odm_orthophoto_tif_log = os.path.join(self.odm_orthophoto, 'gdal_translate_log.txt') # tiles - self.orthophoto_tiles = io.join_paths(self.root_path, "orthophoto_tiles") + self.orthophoto_tiles = os.path.join(self.root_path, "orthophoto_tiles") # Split-merge - self.submodels_path = io.join_paths(self.root_path, 'submodels') + self.submodels_path = os.path.join(self.root_path, 'submodels') # Tiles self.entwine_pointcloud = self.path("entwine_pointcloud") diff --git a/run.py b/run.py index df0dab22..d8dbf00b 100755 --- a/run.py +++ b/run.py @@ -32,7 +32,7 @@ if __name__ == '__main__': # Don't leak token if k == 'sm_cluster' and args_dict[k] is not None: - log.ODM_INFO('%s: True' % k) + log.ODM_INFO('%s: True' % k else: log.ODM_INFO('%s: %s' % (k, args_dict[k])) log.ODM_INFO('==============') @@ -40,7 +40,7 @@ if __name__ == '__main__': progressbc.set_project_name(args.name) # Add project dir if doesn't exist - args.project_path = io.join_paths(args.project_path, args.name) + args.project_path = os.path.join(args.project_path, args.name) if not io.dir_exists(args.project_path): log.ODM_WARNING('Directory %s does not exist. Creating it now.' % args.name) system.mkdir_p(os.path.abspath(args.project_path)) diff --git a/stages/dataset.py b/stages/dataset.py index 0c3ed086..ecb1c5d0 100644 --- a/stages/dataset.py +++ b/stages/dataset.py @@ -88,12 +88,12 @@ class ODMLoadDatasetStage(types.ODM_Stage): log.ODM_INFO('Loading dataset from: %s' % images_dir) # check if we rerun cell or not - images_database_file = io.join_paths(tree.root_path, 'images.json') + images_database_file = os.path.join(tree.root_path, 'images.json') if not io.file_exists(images_database_file) or self.rerun(): files, rejects = get_images(images_dir) if files: # create ODMPhoto list - path_files = [io.join_paths(images_dir, f) for f in files] + path_files = [os.path.join(images_dir, f) for f in files] # Lookup table for masks masks = {} @@ -147,5 +147,5 @@ class ODMLoadDatasetStage(types.ODM_Stage): tree.odm_georeferencing_coords, rerun=self.rerun()) - reconstruction.save_proj_srs(io.join_paths(tree.odm_georeferencing, tree.odm_georeferencing_proj)) + reconstruction.save_proj_srs(os.path.join(tree.odm_georeferencing, tree.odm_georeferencing_proj)) outputs['reconstruction'] = reconstruction diff --git a/stages/mvstex.py b/stages/mvstex.py index 8a90e8a0..eff92899 100644 --- a/stages/mvstex.py +++ b/stages/mvstex.py @@ -80,7 +80,7 @@ class ODMMvsTexStage(types.ODM_Stage): # mvstex definitions kwargs = { 'bin': context.mvstex_path, - 'out_dir': io.join_paths(r['out_dir'], "odm_textured_model"), + 'out_dir': os.path.join(r['out_dir'], "odm_textured_model"), 'model': r['model'], 'dataTerm': self.params.get('data_term'), 'outlierRemovalType': self.params.get('outlier_rem_type'),