-
Notifications
You must be signed in to change notification settings - Fork 6
/
Config.py
84 lines (69 loc) · 1.93 KB
/
Config.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
79
80
81
82
83
84
import yaml
import os
class Config:
def __init__(self):
with open('./settings.yaml') as file:
try:
config = yaml.load(file, Loader=yaml.FullLoader)
except yaml.YAMLError as exc:
print(exc)
self.config = config
self.save_dir = None
@property
def fx(self):
return self.config["Camera.fx"]
@property
def fy(self):
return self.config["Camera.fy"]
@property
def cx(self):
return self.config["Camera.cx"]
@property
def cy(self):
return self.config["Camera.cy"]
@property
def bf(self):
return self.config["Camera.bf"]
@property
def width(self):
return self.config["Camera.width"]
@property
def height(self):
return self.config["Camera.height"]
@property
def dir(self):
if self.save_dir:
return self.save_dir
save_dir = self.config["Dir.save"]
if not os.path.isdir(save_dir):
os.mkdir(save_dir)
dir_list = [int(o) for o in os.listdir(save_dir)
if os.path.isdir(os.path.join(save_dir, o)) and o.isdigit()]
if len(dir_list) == 0:
o = "0"
else:
o = 0
while o in dir_list:
o += 1
o = str(o)
self.save_dir = os.path.join(save_dir, o)
os.mkdir(self.save_dir)
return self.save_dir
@property
def bow(self):
return self.config["Dir.bow"]
@property
def scene(self):
return self.config["Dir.scene"]
@property
def n_features(self):
return self.config["ORBextractor.nFeatures"]
@property
def scale_factor(self):
return self.config["ORBextractor.scaleFactor"]
@property
def n_levels(self):
return self.config["ORBextractor.nLevels"]
@property
def th_fast(self):
return self.config["ORBextractor.thFAST"]