This repository was archived by the owner on Jul 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: rename mediapipe_pose module to pose
- Loading branch information
Showing
14 changed files
with
558 additions
and
10 deletions.
There are no files selected for viewing
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
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
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
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
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
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from enum import Enum | ||
|
||
|
||
class LandmarkType(Enum): | ||
""" | ||
From the MediaPipe documentation: | ||
The output contains both normalized coordinates (Landmarks) and world coordinates (WorldLandmarks) | ||
for each landmark. | ||
The output contains the following normalized coordinates (Landmarks): | ||
- x and y: Landmark coordinates normalized between 0.0 and 1.0 by the image width (x) and height (y). | ||
- z: The landmark depth, with the depth at the midpoint of the hips as the origin. The smaller the value, | ||
the closer the landmark is to the camera. The magnitude of z uses roughly the same scale as x. | ||
- visibility: The likelihood of the landmark being visible within the image. | ||
The output contains the following world coordinates (WorldLandmarks): | ||
- x, y, and z: Real-world 3-dimensional coordinates in meters, with the midpoint of the hips as the origin. | ||
- visibility: The likelihood of the landmark being visible within the image. | ||
""" | ||
|
||
LANDMARKS = 0 | ||
WORLD_LANDMARKS = 1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from enum import Enum | ||
|
||
|
||
class LandmarkerModel(Enum): | ||
LITE = "./resources/pose_landmarker_models/pose_landmarker_lite.task" | ||
FULL = "./resources/pose_landmarker_models/pose_landmarker_full.task" | ||
HEAVY = "./resources/pose_landmarker_models/pose_landmarker_heavy.task" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
from enum import IntEnum | ||
from typing import Self | ||
|
||
|
||
class MarkerEnum(IntEnum): | ||
""" | ||
From the documentation: | ||
0 - nose | ||
1 - left eye (inner) | ||
2 - left eye | ||
3 - left eye (outer) | ||
4 - right eye (inner) | ||
5 - right eye | ||
6 - right eye (outer) | ||
7 - left ear | ||
8 - right ear | ||
9 - mouth (left) | ||
10 - mouth (right) | ||
11 - left shoulder | ||
12 - right shoulder | ||
13 - left elbow | ||
14 - right elbow | ||
15 - left wrist | ||
16 - right wrist | ||
17 - left pinky | ||
18 - right pinky | ||
19 - left index | ||
20 - right index | ||
21 - left thumb | ||
22 - right thumb | ||
23 - left hip | ||
24 - right hip | ||
25 - left knee | ||
26 - right knee | ||
27 - left ankle | ||
28 - right ankle | ||
29 - left heel | ||
30 - right heel | ||
31 - left foot index | ||
32 - right foot index | ||
""" | ||
|
||
NOSE = 0 | ||
LEFT_EYE_INNER = 1 | ||
LEFT_EYE = 2 | ||
LEFT_EYE_OUTER = 3 | ||
RIGHT_EYE_INNER = 4 | ||
RIGHT_EYE = 5 | ||
RIGHT_EYE_OUTER = 6 | ||
LEFT_EAR = 7 | ||
RIGHT_EAR = 8 | ||
MOUTH_LEFT = 9 | ||
MOUTH_RIGHT = 10 | ||
LEFT_SHOULDER = 11 | ||
RIGHT_SHOULDER = 12 | ||
LEFT_ELBOW = 13 | ||
RIGHT_ELBOW = 14 | ||
LEFT_WRIST = 15 | ||
RIGHT_WRIST = 16 | ||
LEFT_PINKY = 17 | ||
RIGHT_PINKY = 18 | ||
LEFT_INDEX = 19 | ||
RIGHT_INDEX = 20 | ||
LEFT_THUMB = 21 | ||
RIGHT_THUMB = 22 | ||
LEFT_HIP = 23 | ||
RIGHT_HIP = 24 | ||
LEFT_KNEE = 25 | ||
RIGHT_KNEE = 26 | ||
LEFT_ANKLE = 27 | ||
RIGHT_ANKLE = 28 | ||
LEFT_HEEL = 29 | ||
RIGHT_HEEL = 30 | ||
LEFT_FOOT_INDEX = 31 | ||
RIGHT_FOOT_INDEX = 32 | ||
|
||
# Some own additions | ||
LEFT_DRUM_STICK = 33 | ||
RIGHT_DRUM_STICK = 34 | ||
LEFT_FOOT = 35 | ||
RIGHT_FOOT = 36 | ||
|
||
@staticmethod | ||
def from_qtm_label(label: str) -> "MarkerEnum": # noqa: PLR0911 | ||
match label: | ||
case "Nose": | ||
return MarkerEnum.NOSE | ||
case "Eye_Inner_L": | ||
return MarkerEnum.LEFT_EYE_INNER | ||
case "Eye_L": | ||
return MarkerEnum.LEFT_EYE | ||
case "Eye_Outer_L": | ||
return MarkerEnum.LEFT_EYE_OUTER | ||
case "Eye_Inner_R": | ||
return MarkerEnum.RIGHT_EYE_INNER | ||
case "Eye_R": | ||
return MarkerEnum.RIGHT_EYE | ||
case "Eye_Outer_R": | ||
return MarkerEnum.RIGHT_EYE_OUTER | ||
case "Ear_L": | ||
return MarkerEnum.LEFT_EAR | ||
case "Ear_R": | ||
return MarkerEnum.RIGHT_EAR | ||
case "Mouth_L": | ||
return MarkerEnum.MOUTH_LEFT | ||
case "Mouth_R": | ||
return MarkerEnum.MOUTH_RIGHT | ||
case "Shoulder_L": | ||
return MarkerEnum.LEFT_SHOULDER | ||
case "Shoulder_R": | ||
return MarkerEnum.RIGHT_SHOULDER | ||
case "Elbow_L": | ||
return MarkerEnum.LEFT_ELBOW | ||
case "Elbow_R": | ||
return MarkerEnum.RIGHT_ELBOW | ||
case "Wrist_L": | ||
return MarkerEnum.LEFT_WRIST | ||
case "Wrist_R": | ||
return MarkerEnum.RIGHT_WRIST | ||
case "Pinky_L": | ||
return MarkerEnum.LEFT_PINKY | ||
case "Pinky_R": | ||
return MarkerEnum.RIGHT_PINKY | ||
case "Index_L": | ||
return MarkerEnum.LEFT_INDEX | ||
case "Index_R": | ||
return MarkerEnum.RIGHT_INDEX | ||
case "Thumb_L": | ||
return MarkerEnum.LEFT_THUMB | ||
case "Thumb_R": | ||
return MarkerEnum.RIGHT_THUMB | ||
case "Hip_L": | ||
return MarkerEnum.LEFT_HIP | ||
case "Hip_R": | ||
return MarkerEnum.RIGHT_HIP | ||
case "Knee_L": | ||
return MarkerEnum.LEFT_KNEE | ||
case "Knee_R": | ||
return MarkerEnum.RIGHT_KNEE | ||
case "Ankle_L": | ||
return MarkerEnum.LEFT_ANKLE | ||
case "Ankle_R": | ||
return MarkerEnum.RIGHT_ANKLE | ||
case "Heel_L": | ||
return MarkerEnum.LEFT_HEEL | ||
case "Heel_R": | ||
return MarkerEnum.RIGHT_HEEL | ||
case "Foot_Index_L": | ||
return MarkerEnum.LEFT_FOOT_INDEX | ||
case "Foot_Index_R": | ||
return MarkerEnum.RIGHT_FOOT_INDEX | ||
case _: | ||
raise ValueError(f"Unknown label: {label}") | ||
|
||
def __str__(self: Self) -> str: | ||
return self.name.replace("_", " ").title() |
Oops, something went wrong.