Args: img: [H, W, 3] kps: [70, 2]
(img, kps, thickness=2, style=FACE_CUSTOM_STYLE)
| 1112 | |
| 1113 | |
| 1114 | def draw_face_kp(img, kps, thickness=2, style=FACE_CUSTOM_STYLE): |
| 1115 | """ |
| 1116 | Args: |
| 1117 | img: [H, W, 3] |
| 1118 | kps: [70, 2] |
| 1119 | """ |
| 1120 | img = img.copy() |
| 1121 | for key, item in style.items(): |
| 1122 | pts = np.array(kps[item["indexs"]]).astype(np.int32) |
| 1123 | connect = item.get("connect", True) |
| 1124 | color = item["color"] |
| 1125 | close = item.get("close", False) |
| 1126 | if connect: |
| 1127 | cv2.polylines(img, [pts], close, color, thickness=thickness) |
| 1128 | else: |
| 1129 | for kp in pts: |
| 1130 | kp = np.array(kp).astype(np.int32) |
| 1131 | cv2.circle(img, kp, thickness * 2, color=color, thickness=-1) |
| 1132 | return img |
| 1133 | |
| 1134 | |
| 1135 | def draw_traj(metas: List[AAPoseMeta], threshold=0.6): |