MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / draw_face_kp

Function draw_face_kp

tools/preprocess/human_visualization.py:1114–1132  ·  view source on GitHub ↗

Args: img: [H, W, 3] kps: [70, 2]

(img, kps, thickness=2, style=FACE_CUSTOM_STYLE)

Source from the content-addressed store, hash-verified

1112
1113
1114def 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
1135def draw_traj(metas: List[AAPoseMeta], threshold=0.6):

Callers

nothing calls this directly

Calls 3

copyMethod · 0.80
itemsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected