-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprobMapsRetreiver.py
51 lines (49 loc) · 1.07 KB
/
probMapsRetreiver.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
from os import path
if not path.isfile("./probMaps.txt"):
print("You need to get the prob map first")
exit(-1)
with open("./probMaps.txt", "r") as f:
keypoints_mapping = [
"Head",
"Neck",
"R-Sho",
"R-Elb",
"R-Wr",
"L-Sho",
"L-Elb",
"L-Wr",
"R-Hip",
"R-Knee",
"R-Ank",
"L-Hip",
"L-Knee",
"L-Ank",
"Chest",
]
x = y = 0
mapping = 0
line = f.readline()
o = None
while True:
if "#" in line:
x = 0
y = 0
if o:
o.close()
o = open(
f"./probMaps{keypoints_mapping[mapping]}.txt",
"w",
)
mapping += 1
elif line.strip():
for el in line.split(" "):
if el.strip():
o.write(f"{el} ")
x += 1
x = 0
y += 1
o.write("\n")
line = f.readline()
if not line:
o.close()
exit()