-
Notifications
You must be signed in to change notification settings - Fork 4
/
msInterface.py
85 lines (54 loc) · 1.93 KB
/
msInterface.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import Metashape
from msFunctions.msSubsetImages import subsetImages
from msFunctions.msError import exportMarker
from msFunctions.msExportTiepointError import *
from msFunctions.msOptimizeSparsecloud import *
from msFunctions.msReproducibility import *
from msFunctions.msDenseCloud import *
# helper for optional all chunk processing:
def menuHelper(fun):
def menuFunc():
ac = Metashape.app.getBool("Process all chunks?")
if ac:
for chunk in Metashape.app.document.chunks:
fun(chunk)
else:
fun(chunk)
return menuFunc
menuSubsetImages = menuHelper(subsetImages)
def menuError():
ac = Metashape.app.getBool("Process all chunks?")
if ac:
for chunk in Metashape.app.document.chunks:
exportMarker(chunk)
else:
exportMarker(chunk)
def menuTiepoints():
ac = Metashape.app.getBool("Process all chunks?")
if ac:
for chunk in Metashape.app.document.chunks:
ExportTiepointError(chunk)
else:
ExportTiepointError(chunk)
def menuDensecloud():
ac = Metashape.app.getBool("Process all chunks?")
if ac:
for chunk in Metashape.app.document.chunks:
createDenseCloud(chunk)
else:
createDenseCloud(chunk)
def menuOptimizeSparsecloud():
chunk = Metashape.app.document.chunk
optimizeSparsecloud(chunk)
def menuReproducibility():
RE = Metashape.app.getFloat(label = "Optimal Reprojection Error", value = 0)
k = Metashape.app.getInt(label = "Times", value = 5)
repro(chunk, RE = RE, k = k)
Metashape.app.addMenuItem("MetashapeTools/Subset Images", menuSubsetImages)
Metashape.app.addMenuItem("MetashapeTools/Export Marker Error", menuError)
Metashape.app.addMenuItem("MetashapeTools/Export Tiepoint Error", menuTiepoints)
Metashape.app.addMenuItem("MetashapeTools/Optimize Sparsecloud", menuOptimizeSparsecloud)
Metashape.app.addMenuItem("MetashapeTools/Reproducibility", menuReproducibility)
Metashape.app.addMenuItem("MetashapeTools/Densecloud", menuDensecloud)