-
Notifications
You must be signed in to change notification settings - Fork 0
/
06_build_orthomosaic.py
42 lines (33 loc) · 1.32 KB
/
06_build_orthomosaic.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
# Viet Nguyen
# University of Greifswald
# based on the Geo-SfM course from The University Centre in Svalbard
# and the work from Derek Young and Alex Mandel (https://github.com/open-forest-observatory/automate-metashape/tree/main).
import Metashape
import time
doc = Metashape.app.document # accesses the current project and document
def diff_time(t2, t1):
'''
Give a end and start time, subtract, and round
'''
total = str(round(t2-t1, 1))
return total
### Build orthomosaic
# get a beginning time stamp for the next step
timer6a = time.time()
# prepping projection
projection = Metashape.OrthoProjection()
projection.crs = Metashape.CoordinateSystem("EPSG::5650")
# build orthomosaic
doc.chunk.buildOrthomosaic(surface_data=Metashape.ModelData,
blending_mode=Metashape.MosaicBlending,
ghosting_filter=True,
fill_holes=True,
cull_faces=True,
refine_seamlines=True, # True as OFO
projection=projection)
doc.save()
# get an ending time stamp for the previous step
timer6b = time.time()
# calculate difference between end and start time to 1 decimal place
time6 = diff_time(timer6b, timer6a)
print('Build Orthomosaic finished after',time6,'seconds.')