OpenSfM multi band NVM export

Former-commit-id: c32fb79a38
pull/1161/head
Piero Toffanin 2019-12-13 19:40:04 +00:00
rodzic 5ec1b58a70
commit 5042787d4c
3 zmienionych plików z 29 dodań i 11 usunięć

Wyświetl plik

@ -87,7 +87,6 @@ class ODM_Photo:
if cit in tags:
self.band_index = int(tags[cit])
self.width, self.height = get_image_size.get_image_size(_path_file)
print(self)
# From https://github.com/mapillary/OpenSfM/blob/master/opensfm/exif.py
def get_xmp(self, file):
@ -328,8 +327,8 @@ class ODM_Tree(object):
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, 'reconstruction.nvm')
self.opensfm_model = io.join_paths(self.opensfm, 'depthmaps/merged.ply')
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')
# mve
@ -354,8 +353,6 @@ class ODM_Tree(object):
self.odm_texuring_log = 'odm_texturing_log.txt'
# odm_georeferencing
self.odm_georeferencing_latlon = io.join_paths(
self.odm_georeferencing, 'latlon.txt')
self.odm_georeferencing_coords = io.join_paths(
self.odm_georeferencing, 'coords.txt')
self.odm_georeferencing_gcp = gcp_file or io.find('gcp_list.txt', self.root_path)

Wyświetl plik

@ -74,7 +74,7 @@ class ODMMvsTexStage(types.ODM_Stage):
'toneMapping': self.params.get('tone_mapping'),
'nadirMode': nadir,
'nadirWeight': 2 ** args.texturing_nadir_weight - 1,
'nvm_file': io.join_paths(tree.opensfm, "reconstruction.nvm")
'nvm_file': tree.opensfm_reconstruction_nvm
}
mvs_tmp_dir = os.path.join(r['out_dir'], 'tmp')

Wyświetl plik

@ -57,7 +57,7 @@ class ODMOpenSfMStage(types.ODM_Stage):
octx.touch(updated_config_flag_file)
# These will be used for texturing / MVS
undistorted_images_path = octx.path("undistorted")
undistorted_images_path = octx.path("undistorted", "images")
if not io.dir_exists(undistorted_images_path) or self.rerun():
octx.run('undistort')
@ -66,11 +66,32 @@ class ODMOpenSfMStage(types.ODM_Stage):
self.update_progress(80)
if not io.file_exists(tree.opensfm_reconstruction_nvm) or self.rerun():
octx.run('export_visualsfm --undistorted --points')
if not reconstruction.multi_camera:
if not io.file_exists(tree.opensfm_reconstruction_nvm) or self.rerun():
octx.run('export_visualsfm --points')
else:
log.ODM_WARNING('Found a valid OpenSfM NVM reconstruction file in: %s' %
tree.opensfm_reconstruction_nvm)
else:
log.ODM_WARNING('Found a valid OpenSfM NVM reconstruction file in: %s' %
tree.opensfm_reconstruction_nvm)
# Dump band image lists
log.ODM_INFO("Multiple bands found")
for band in reconstruction.multi_camera:
log.ODM_INFO("Exporting %s band" % band['name'])
image_list_file = octx.path("image_list_%s.txt" % band['name'].lower())
if not io.file_exists(image_list_file) or self.rerun():
with open(image_list_file, "w") as f:
f.write("\n".join([p.filename for p in band['photos']]))
log.ODM_INFO("Wrote %s" % image_list_file)
else:
log.ODM_WARNING("Found a valid image list in %s for %s band" % (image_list_file, band['name']))
nvm_file = octx.path("undistorted", "reconstruction_%s.nvm" % band['name'].lower())
if not io.file_exists(nvm_file) or self.rerun():
octx.run('export_visualsfm --points --image_list "%s"' % image_list_file)
os.rename(tree.opensfm_reconstruction_nvm, nvm_file)
else:
log.ODM_WARNING("Found a valid NVM file in %s for %s band" % (nvm_file, band['name']))
self.update_progress(85)