-
Notifications
You must be signed in to change notification settings - Fork 0
/
Agisoft_processing_chain_export_orthos.py
51 lines (41 loc) · 2.2 KB
/
Agisoft_processing_chain_export_orthos.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 14 13:09:29 2021
@author: Kneib
"""
import Metashape
# define directories
resultsdir = 'path/2/resultsdir/'
# loop through all image pairs to process
for ii in [317,318]:
doc = Metashape.app.document
path = ''.join(['path/2/agisoft_folder/TL',str(ii),'_v1.psx'])
doc.open(path)
chunk = doc.chunk
# Checking compatibility
compatible_major_version = "1.7"
found_major_version = ".".join(Metashape.app.version.split('.')[:2])
if found_major_version != compatible_major_version:
raise Exception("Incompatible Metashape version: {} != {}".format(found_major_version, compatible_major_version))
## export dem & point cloud
#chunk.exportModel(path=''.join([resultsdir,'PC_TL',str(ii),'_v5.obj']), texture_format=Metashape.ImageFormatTIFF,save_texture=True,\
# save_uv=True,save_normals=True,save_colors=True,save_confidence=True,\
# save_cameras=True,save_markers=True,save_udim=True,\
# save_alpha=True,embed_texture=True,strip_extensions=False,\
# raster_transform=Metashape.RasterTransformNone,colors_rgb_8bit=True,\
# format=Metashape.ModelFormatOBJ,clip_to_boundary=True)
#
#
chunk.buildDem(source_data=Metashape.DenseCloudData,interpolation=Metashape.DisabledInterpolation)
doc.save(path)
chunk.buildOrthomosaic(surface_data=Metashape.DataSource.ElevationData, fill_holes=False,\
resolution=0.24, resolution_x=0.24, resolution_y=0.24, flip_x=False, flip_y=False,\
flip_z=False, subdivide_task=True)
doc.save(path)
chunk.exportRaster(path=''.join([resultsdir,'Ortho_TL',str(ii),'_v1.tif']),\
format=Metashape.RasterFormat.RasterFormatTiles,image_format=Metashape.ImageFormat.ImageFormatTIFF,\
raster_transform=Metashape.RasterTransformType.RasterTransformNone,\
resolution=0.24,resolution_x=0.24,resolution_y=0.24,\
source_data=Metashape.DataSource.OrthomosaicData)
#print("Script finished")
#