-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvert_pose.py
More file actions
33 lines (28 loc) · 2.05 KB
/
convert_pose.py
File metadata and controls
33 lines (28 loc) · 2.05 KB
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
pose = [383.14868960588115, 166.57613904839698, 0.8897280914845824, 383.23506327822, 348.25604224331494, 0.7971439243723208, 248.3069796284956, 350.9076214737701, 0.7035252470912432, 209.32135619718306, 595.7821501530924, 0.7145791737497449, 209.10193921616656, 805.4902752704634, 0.6823199557460706, 518.631160542968, 346.0913216676873, 0.6982457590324557, 558.9818305776689, 590.4522829148806, 0.6991681439375383, 549.8331653806899, 793.8501676872833, 0.7130639860481731, 381.2790169508833, 781.5721500051056, 0.4539014175227203, 292.66959845776734, 783.0465711367583, 0.42143422336839953, 284.6468300898204, 984.1205370508983, 0.18356423918413173, 326.25504545454544, 940.0164999999997, 0.5662303045454545, 470.330921254213, 784.9308321928302, 0.4119644865386579, 478.2944522238164, 988.8775147776184, 0.16959311678622666, 404.16194444444443, 931.8767222222222, 0.6731623277777777, 352.530296689486, 137.5175559670992, 0.9037756044753243, 413.1435443387542, 137.19208525212235, 0.9019331232484401, 313.4173382621787, 158.23918306161954, 0.7628140647166362, 451.5738539350578, 156.1445775354981, 0.7712347528453495, 398.9081764705883, 988.3306470588235, 0.5656893529411765, 412.8987058823529, 983.4841176470588, 0.5508874705882354, 396.885625, 942.566125, 0.5593918125, 327.33566666666667, 985.7220555555555, 0.5294426555555555, 296.803625, 978.5165625, 0.525551425, 343.53694736842107, 945.1844736842104, 0.5373169315789473]
target_index = [0,15,16,17,18,2,3,4,5,6,7,9,10,12,13]
body_parts = {
0: "nose",
15: "right_eye",
16: "left_eye",
17: "right_ear",
18: "left_ear",
2: "right_shoulder",
3: "right_elbow",
4: "right_wrist",
5: "left_shoulder",
6: "left_elbow",
7: "left_wrist",
9: "right_hip",
10: "right_knee",
12: "left_hip",
13: "left_knee"
}
pose_converted = {}
index = 0
for i in range(0,73,3):
if index in target_index:
new_index = body_parts[index]
keypoints = pose[i:i+2]
pose_converted[new_index] = {'x' : keypoints[0] , 'y' : keypoints[1]}
index += 1
print(pose_converted)