-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlandmark_groups.py
More file actions
161 lines (142 loc) · 7.3 KB
/
landmark_groups.py
File metadata and controls
161 lines (142 loc) · 7.3 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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# ============================================================================
# File: landmark_groups.py
# ============================================================================
# COMPREHENSIVE FACE LANDMARK GROUPS & CONNECTIONS
# ============================================================================
# Organized for MediaPipe 478-point face model
# ============================================================================
# ============================================================================
# FEATURE GROUPS - Organized by facial anatomy
# ============================================================================
feature_groups = {
# Face boundary
'outline': [10, 21, 54, 58, 67, 93, 103, 109, 127, 132, 136, 148, 149,
150, 152, 162, 172, 176, 234, 251, 284, 288, 297, 323, 332,
338, 356, 361, 365, 377, 378, 379, 389, 397, 400, 454],
# Upper face
'forehead': [68, 69, 71, 104, 108, 139, 151, 298, 299, 301, 333, 337, 368],
# Eyebrows
'eyebrow_left': [46, 52, 53, 55, 63, 65, 66, 70, 105, 107, 156],
'eyebrow_right': [282, 283, 285, 293, 295, 296, 300, 334, 336, 383],
'eyebrow_bridge': [8, 9],
# Eyes
'iris_left': [468, 469, 470, 471, 472],
'iris_right': [473, 474, 475, 476, 477],
'eyeball_left': [7, 33, 130, 133, 144, 145, 153, 154, 155, 157, 158,
159, 160, 161, 163, 173, 243, 246, 470],
'eyeball_right': [249, 263, 359, 362, 373, 374, 380, 381, 382, 384,
385, 386, 387, 388, 390, 398, 463, 466, 475],
'eyesocket_left': [22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 35, 56, 110,
112, 113, 124, 143, 189, 190, 193, 221, 222, 223,
224, 225, 226, 228, 229, 230, 231, 232, 233, 243,
244, 247],
'eyesocket_right': [252, 253, 254, 255, 256, 257, 258, 259, 260, 261,
265, 276, 286, 339, 341, 342, 353, 398, 413, 414,
417, 441, 442, 443, 444, 445, 446, 448, 449, 450,
451, 452, 453, 464, 467],
# Nose
'nose_bridge': [5, 6, 168, 195, 197],
'nose_tip': [4],
'nose_left': [3, 45, 48, 49, 51, 102, 115, 122, 131, 134, 174, 196,
198, 209, 217, 220, 236],
'nose_right': [248, 275, 279, 281, 351, 360, 363, 399, 419, 420, 429,
437, 440, 456],
'nostril_left': [20, 44, 59, 60, 64, 75, 79, 98, 125, 141, 166, 218,
219, 235, 237, 238, 239, 240, 241, 242],
'nostril_right': [250, 274, 278, 289, 290, 294, 305, 309, 326, 327,
328, 331, 344, 354, 358, 370, 392, 438, 439, 455,
457, 458, 459, 460, 461, 462],
'nose_center': [1, 2, 19, 94],
# Cheeks
'cheek_left': [34, 36, 47, 100, 101, 111, 114, 116, 117, 118, 119, 120,
121, 123, 126, 128, 129, 135, 137, 138, 142, 147, 177,
187, 188, 192, 203, 205, 206, 207, 213, 214, 215, 216,
227, 245],
'cheek_right': [264, 266, 277, 329, 330, 340, 343, 345, 346, 347, 348,
349, 350, 352, 355, 357, 364, 366, 367, 371, 372, 376,
394, 401, 411, 412, 416, 423, 425, 426, 427, 430, 432,
433, 434, 435, 436, 447, 465],
# Zygomatic (cheekbones)
'zygomatic_left': [50],
'zygomatic_right': [280],
# Mouth region
'above_mouth': [43, 57, 60, 92, 97, 99, 164, 165, 167, 186, 202, 212,
287, 322, 391, 393, 410, 422],
'below_mouth': [18, 32, 83, 106, 140, 169, 170, 171, 175, 182, 194, 199,
200, 201, 204, 208, 210, 211, 262, 273, 313, 335, 369,
395, 396, 406, 418, 421, 424, 428, 431],
# Lips
'lips': [0, 11, 12, 13, 14, 15, 16, 17, 37, 38, 39, 40, 41, 42, 61, 62,
72, 73, 74, 76, 77, 78, 80, 81, 82, 84, 85, 86, 87, 88, 89, 90,
91, 95, 96, 146, 178, 179, 180, 181, 183, 184, 185, 191, 267,
268, 269, 270, 271, 272, 291, 292, 302, 303, 304, 306, 307, 308,
310, 311, 312, 314, 315, 316, 317, 318, 319, 320, 321, 324, 325,
375, 402, 403, 404, 405, 407, 408, 409, 415]
}
# ============================================================================
# FACE CONNECTIONS - Organized by facial region to create outlines of regions
# ============================================================================
face_connections = {
# Region: Face Outline (oval)
'face_oval': [
(10, 338), (338, 297), (297, 332), (332, 284), (284, 251), (251, 389),
(389, 356), (356, 454), (454, 323), (323, 361), (361, 288), (288, 397),
(397, 365), (365, 379), (379, 378), (378, 400), (400, 377), (377, 152),
(152, 148), (148, 176), (176, 149), (149, 150), (150, 136), (136, 172),
(172, 58), (58, 132), (132, 93), (93, 234), (234, 127), (127, 162),
(162, 21), (21, 54), (54, 103), (103, 67), (67, 109), (109, 10)
],
# Region: Jawline (complements face oval)
'jawline': [
(58, 172), (172, 136), (136, 150), (150, 149), (149, 176),
(176, 148), (148, 152), (152, 377), (377, 400), (400, 378),
(378, 379), (379, 365), (365, 397), (397, 288), (288, 361),
(361, 323), (323, 454), (454, 356), (356, 389), (389, 251),
(251, 284), (284, 332), (332, 297), (297, 338), (338, 10),
(10, 109), (109, 67), (67, 103), (103, 54), (54, 21), (21, 162),
(162, 127), (127, 234), (234, 93), (93, 132), (132, 58)
],
# Region: Eyebrows
'eyebrow_left': [
(46, 53), (53, 52), (52, 65), (65, 55)
],
'eyebrow_right': [
(276, 283), (283, 282), (282, 295), (295, 285)
],
# Region: Eyes
'eye_left': [
(33, 246), (246, 161), (161, 160), (160, 159), (159, 158), (158, 157),
(157, 173), (173, 133), (133, 155), (155, 154), (154, 153), (153, 145),
(145, 144), (144, 163), (163, 7), (7, 33)
],
'eye_right': [
(263, 466), (466, 388), (388, 387), (387, 386), (386, 385), (385, 384),
(384, 398), (398, 362), (362, 382), (382, 381), (381, 380), (380, 374),
(374, 373), (373, 390), (390, 249), (249, 263)
],
# Region: Nose
'nose_bridge': [
(168, 6), (6, 197), (197, 195), (195, 5), (5, 4)
],
'nostrils': [
(2, 326), (326, 327), (327, 294), (294, 278), (278, 344),
(344, 440), (440, 275), (275, 4), (4, 45), (45, 220), (220, 115),
(115, 48), (48, 64), (64, 98), (98, 240)
],
# Region: Lips/Mouth
'lips_outer': [
(61, 185), (185, 40), (40, 39), (39, 37), (37, 0), (0, 267),
(267, 269), (269, 270), (270, 409), (409, 291), (291, 375),
(375, 321), (321, 405), (405, 314), (314, 17), (17, 84),
(84, 181), (181, 91), (91, 146), (146, 61)
],
'lips_inner': [
(78, 95), (95, 88), (88, 178), (178, 87), (87, 14), (14, 317),
(317, 402), (402, 318), (318, 324), (324, 308), (308, 415),
(415, 310), (310, 311), (311, 312), (312, 13), (13, 82),
(82, 81), (81, 80), (80, 191), (191, 78)
]
}
# ============================================================================
# End of landmark_groups.py
# ============================================================================