Tentativas de fazer rodar o FaceLandmarkerOptions no HF
Browse files
app/mediapipe_processor.py
CHANGED
|
@@ -81,7 +81,14 @@ def extract_face_signals(video_path, logger=None):
|
|
| 81 |
# 🔄 Converter para formato MediaPipe
|
| 82 |
mp_image = mp.Image(image_format=mp.ImageFormat.SRGB, data=rgb)
|
| 83 |
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
if result.face_landmarks:
|
| 87 |
landmarks = result.face_landmarks[0]
|
|
|
|
| 81 |
# 🔄 Converter para formato MediaPipe
|
| 82 |
mp_image = mp.Image(image_format=mp.ImageFormat.SRGB, data=rgb)
|
| 83 |
|
| 84 |
+
# 🧠 timestamp obrigatório no VIDEO mode
|
| 85 |
+
#timestamp = int(frame_count * 33) # ~30 FPS
|
| 86 |
+
|
| 87 |
+
# 🔥 alternativa mais precisa de timestamp usando FPS real do vídeo
|
| 88 |
+
fps = cap.get(cv2.CAP_PROP_FPS) or 30
|
| 89 |
+
timestamp = int(frame_count * (1000 / fps))
|
| 90 |
+
|
| 91 |
+
result = detector.detect(mp_image, timestamp)
|
| 92 |
|
| 93 |
if result.face_landmarks:
|
| 94 |
landmarks = result.face_landmarks[0]
|