Spaces:
Sleeping
Sleeping
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -230,19 +230,6 @@ def get_landmark_features(kp_results, dict_features, feature, frame_width, frame
|
|
| 230 |
raise ValueError("feature needs to be either 'nose', 'left' or 'right")
|
| 231 |
|
| 232 |
def get_mediapipe_pose(
|
| 233 |
-
"""
|
| 234 |
-
This function creates a MediaPipe Pose object for human pose estimation.
|
| 235 |
-
|
| 236 |
-
Args:
|
| 237 |
-
static_image_mode: Flag for processing a single static image (default: False).
|
| 238 |
-
model_complexity: Level of complexity for the pose model (default: 1).
|
| 239 |
-
smooth_landmarks: Enable smoothing of detected landmarks (default: True).
|
| 240 |
-
min_detection_confidence: Minimum confidence threshold for person detection (default: 0.5).
|
| 241 |
-
min_tracking_confidence: Minimum confidence threshold for pose tracking (default: 0.5).
|
| 242 |
-
|
| 243 |
-
Returns:
|
| 244 |
-
A MediaPipe Pose object.
|
| 245 |
-
"""
|
| 246 |
static_image_mode = False,
|
| 247 |
model_complexity = 1,
|
| 248 |
smooth_landmarks = True,
|
|
@@ -257,4 +244,17 @@ def get_mediapipe_pose(
|
|
| 257 |
min_detection_confidence = min_detection_confidence,
|
| 258 |
min_tracking_confidence = min_tracking_confidence
|
| 259 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
return pose
|
|
|
|
| 230 |
raise ValueError("feature needs to be either 'nose', 'left' or 'right")
|
| 231 |
|
| 232 |
def get_mediapipe_pose(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
static_image_mode = False,
|
| 234 |
model_complexity = 1,
|
| 235 |
smooth_landmarks = True,
|
|
|
|
| 244 |
min_detection_confidence = min_detection_confidence,
|
| 245 |
min_tracking_confidence = min_tracking_confidence
|
| 246 |
)
|
| 247 |
+
"""
|
| 248 |
+
This function extracts landmark coordinates for various body parts based on a feature name.
|
| 249 |
+
|
| 250 |
+
Args:
|
| 251 |
+
kp_results: The MediaPipe pose landmark results object.
|
| 252 |
+
dict_features: A dictionary containing landmark key names for different body parts.
|
| 253 |
+
feature: The name of the body part feature to extract (e.g., 'nose', 'left', 'right').
|
| 254 |
+
frame_width: The width of the image frame.
|
| 255 |
+
frame_height: The height of the image frame.
|
| 256 |
+
|
| 257 |
+
Returns:
|
| 258 |
+
A list containing the landmark coordinates (as NumPy arrays) or raises an error if the feature is invalid.
|
| 259 |
+
"""
|
| 260 |
return pose
|