-
-
Save J22Melody/72b85a2e01918e47479faec0d257774c to your computer and use it in GitHub Desktop.
Operate Mediapipe Holistic poses
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def restore_dimensions(pose: Pose, weight: float, height: float) -> Pose: | |
import numpy as np | |
pose.body.data = pose.body.data * np.array([width, height, 1.0]) | |
return pose | |
def reduce_holistic(pose: Pose) -> Pose: | |
import mediapipe as mp | |
points_set = set([p for p_tup in list(mp.solutions.holistic.FACEMESH_CONTOURS) for p in p_tup]) | |
face_contours = [str(p) for p in sorted(points_set)] | |
components = [c.name for c in pose.header.components] | |
return pose.get_components(components, {"FACE_LANDMARKS": face_contours}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment