Handle TIFF inputs for --align

pull/1565/head
Piero Toffanin 2022-12-09 11:53:38 -05:00
rodzic 360ab3cc5f
commit d74f573dbf
4 zmienionych plików z 15 dodań i 3 usunięć

Wyświetl plik

@ -33,6 +33,8 @@ def compute_alignment_matrix(input_laz, align_file, stats_dir):
)
reg = app_reg.get_registration_transformation()
# print(dsm_reg.registration_parameters)
# print(icp_reg.registration_parameters)
matrix = np.fromstring(reg['matrix'], dtype=float, sep=' ').reshape((4, 4))
return matrix

Wyświetl plik

@ -296,7 +296,7 @@ class ODM_Tree(object):
self.odm_georeferencing_gcp = gcp_file or io.find('gcp_list.txt', self.root_path)
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_align_file = align_file or io.find('align.laz', self.root_path)
self.odm_align_file = align_file or io.find('align.laz', self.root_path) or io.find('align.tif', self.root_path)
self.odm_georeferencing_proj = 'proj.txt'
self.odm_georeferencing_model_txt_geo = os.path.join(

Wyświetl plik

@ -68,11 +68,15 @@ class ODMMvsTexStage(types.ODM_Stage):
system.mkdir_p(r['out_dir'])
odm_textured_model_obj = os.path.join(r['out_dir'], tree.odm_textured_model_obj)
unaligned_obj = io.related_file_path(odm_textured_model_obj, postfix="_unaligned")
if not io.file_exists(odm_textured_model_obj) or self.rerun():
log.ODM_INFO('Writing MVS Textured file in: %s'
% odm_textured_model_obj)
if os.path.isfile(unaligned_obj):
os.unlink(unaligned_obj)
# Format arguments to fit Mvs-Texturing app
skipGlobalSeamLeveling = ""
skipLocalSeamLeveling = ""

Wyświetl plik

@ -30,6 +30,9 @@ class ODMGeoreferencingStage(types.ODM_Stage):
gcp_export_file = tree.path("odm_georeferencing", "ground_control_points.gpkg")
gcp_gml_export_file = tree.path("odm_georeferencing", "ground_control_points.gml")
gcp_geojson_export_file = tree.path("odm_georeferencing", "ground_control_points.geojson")
unaligned_model = io.related_file_path(tree.odm_georeferencing_model_laz, postfix="_unaligned")
if os.path.isfile(unaligned_model) and self.rerun():
os.unlink(unaligned_model)
if reconstruction.has_gcp() and (not io.file_exists(gcp_export_file) or self.rerun()):
octx = OSFMContext(tree.opensfm)
@ -179,7 +182,8 @@ class ODMGeoreferencingStage(types.ODM_Stage):
log.ODM_INFO("Alignment matrix: %s" % a_matrix)
# Align point cloud
unaligned_model = io.related_file_path(tree.odm_georeferencing_model_laz, postfix="_unaligned")
if os.path.isfile(unaligned_model):
os.rename(unaligned_model, tree.odm_georeferencing_model_laz)
os.rename(tree.odm_georeferencing_model_laz, unaligned_model)
try:
@ -188,12 +192,14 @@ class ODMGeoreferencingStage(types.ODM_Stage):
except Exception as e:
log.ODM_WARNING("Cannot transform point cloud: %s" % str(e))
os.rename(unaligned_model, tree.odm_georeferencing_model_laz)
# Align textured models
for texturing in [tree.odm_texturing, tree.odm_25dtexturing]:
obj = os.path.join(texturing, "odm_textured_model_geo.obj")
if os.path.isfile(obj):
unaligned_obj = io.related_file_path(obj, postfix="_unaligned")
if os.path.isfile(unaligned_obj):
os.rename(unaligned_obj, obj)
os.rename(obj, unaligned_obj)
try:
transform_obj(unaligned_obj, a_matrix, [reconstruction.georef.utm_east_offset, reconstruction.georef.utm_north_offset], obj)