File size: 1,950 Bytes
1cdc47e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# For better visualization, give different colors to different bones

h36m_elbow_knee_v1 = [5, 15]
h36m_elbow_knee_v2 = [2, 12]
h36m_wrist_ankle_v1 = [6, 16]
h36m_wrist_ankle_v2 = [3, 13]
h36m_hip_shoulder = [1, 4, 11, 14]
h36m_spine_neck = [7, 9]
h36m_thorax_head = [8, 10]


def h36m_color_edge(joint_num):
    if joint_num in h36m_elbow_knee_v1:
        color = 'peru'  # (205, 133, 63)
    elif joint_num in h36m_elbow_knee_v2:
        color = 'indianred'  # (205, 92, 92)
    elif joint_num in h36m_wrist_ankle_v1:
        color = 'coral'  # (255, 127, 80)
    elif joint_num in h36m_wrist_ankle_v2:
        # color = 'deepskyblue'
        color = 'brown'  # (165, 42, 42)
    elif joint_num in h36m_hip_shoulder:
        # color = 'dodgerblue'
        color = 'tan'  # (210, 180, 140)
    elif joint_num in h36m_spine_neck:
        color = 'olive'  # (128, 128, 0)
    else:
        color = 'purple'  # (128, 0, 128)
    return color


ntu_elbow_knee_v1 = [6, 18]
ntu_elbow_knee_v2 = [10, 14]
ntu_wrist_ankle_v1 = [8, 19]
ntu_wrist_ankle_v2 = [12, 15]
ntu_hip_shoulder = [13, 17, 5, 9]
ntu_spine_neck = [2, 3]
ntu_thorax_head = [21, 4]
ntu_foot = [16, 20]
ntu_middle_wrist = [7, 11]
ntu_thumbs = [23, 25]
ntu_middle_finger = [22, 24]


def ntu_color_edge(joint_num):
    if joint_num in ntu_elbow_knee_v1:
        color = 'peru'
    elif joint_num in ntu_elbow_knee_v2:
        color = 'indianred'
    elif joint_num in ntu_wrist_ankle_v1:
        color = 'coral'
    elif joint_num in ntu_wrist_ankle_v2:
        color = 'brown'
    elif joint_num in ntu_hip_shoulder:
        color = 'tan'
    elif joint_num in ntu_spine_neck:
        color = 'olive'
    elif ntu_thorax_head:
        color = 'purple'
    elif joint_num in ntu_foot:
        color = 'deepskyblue'
    elif joint_num in ntu_middle_wrist:
        color = 'dodgerblue'
    elif joint_num in ntu_thumbs:
        color = 'red'
    else:
        color = 'yellow'
    return color