Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files- measure_finger.py +5 -3
- src/debug_observer.py +3 -1
measure_finger.py
CHANGED
|
@@ -366,13 +366,15 @@ def _overlay_sam_masks(
|
|
| 366 |
card_u8 = _prepare(card_mask)
|
| 367 |
|
| 368 |
# Solid contours only — no tinted fill, so the underlying photo stays
|
| 369 |
-
# at full brightness inside the SAM silhouettes.
|
|
|
|
|
|
|
| 370 |
if hand_u8 is not None:
|
| 371 |
contours, _ = cv2.findContours(hand_u8, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
| 372 |
-
cv2.drawContours(out, contours, -1, Color.CONTOUR,
|
| 373 |
if card_u8 is not None:
|
| 374 |
contours, _ = cv2.findContours(card_u8, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
| 375 |
-
cv2.drawContours(out, contours, -1, Color.CONTOUR,
|
| 376 |
|
| 377 |
return out
|
| 378 |
|
|
|
|
| 366 |
card_u8 = _prepare(card_mask)
|
| 367 |
|
| 368 |
# Solid contours only — no tinted fill, so the underlying photo stays
|
| 369 |
+
# at full brightness inside the SAM silhouettes. Drawn at thickness 4
|
| 370 |
+
# so the silhouette reads as the primary outline; the internal hand
|
| 371 |
+
# skeleton uses a thinner stroke so it stays a supporting reference.
|
| 372 |
if hand_u8 is not None:
|
| 373 |
contours, _ = cv2.findContours(hand_u8, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
| 374 |
+
cv2.drawContours(out, contours, -1, Color.CONTOUR, 4, cv2.LINE_AA)
|
| 375 |
if card_u8 is not None:
|
| 376 |
contours, _ = cv2.findContours(card_u8, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
| 377 |
+
cv2.drawContours(out, contours, -1, Color.CONTOUR, 4, cv2.LINE_AA)
|
| 378 |
|
| 379 |
return out
|
| 380 |
|
src/debug_observer.py
CHANGED
|
@@ -189,10 +189,12 @@ def draw_hand_skeleton(image: np.ndarray, landmarks: np.ndarray) -> np.ndarray:
|
|
| 189 |
|
| 190 |
# Draw connections in the shared CONTOUR color so the skeleton matches
|
| 191 |
# the hand silhouette and stays distinct from the per-finger band colors.
|
|
|
|
|
|
|
| 192 |
for idx1, idx2 in HAND_CONNECTIONS:
|
| 193 |
pt1 = (int(landmarks[idx1, 0]), int(landmarks[idx1, 1]))
|
| 194 |
pt2 = (int(landmarks[idx2, 0]), int(landmarks[idx2, 1]))
|
| 195 |
-
cv2.line(overlay, pt1, pt2, Color.CONTOUR,
|
| 196 |
|
| 197 |
# Draw landmarks on top
|
| 198 |
for i, (x, y) in enumerate(landmarks):
|
|
|
|
| 189 |
|
| 190 |
# Draw connections in the shared CONTOUR color so the skeleton matches
|
| 191 |
# the hand silhouette and stays distinct from the per-finger band colors.
|
| 192 |
+
# Thickness 2 (vs. the silhouette's 4) keeps the skeleton as a supporting
|
| 193 |
+
# internal reference rather than competing with the outer contour.
|
| 194 |
for idx1, idx2 in HAND_CONNECTIONS:
|
| 195 |
pt1 = (int(landmarks[idx1, 0]), int(landmarks[idx1, 1]))
|
| 196 |
pt2 = (int(landmarks[idx2, 0]), int(landmarks[idx2, 1]))
|
| 197 |
+
cv2.line(overlay, pt1, pt2, Color.CONTOUR, 2, cv2.LINE_AA)
|
| 198 |
|
| 199 |
# Draw landmarks on top
|
| 200 |
for i, (x, y) in enumerate(landmarks):
|