mirror of
https://git.roussel.pro/telecom-paris/pact.git
synced 2026-02-09 02:20:17 +01:00
intégration de la détéction audio à l'interface
This commit is contained in:
@@ -1,13 +1,18 @@
|
||||
import cv2
|
||||
import mediapipe as mp
|
||||
import numpy as np
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
load_dotenv()
|
||||
|
||||
|
||||
class HandDetector():
|
||||
def __init__(self):
|
||||
self.camera_id = int(os.getenv("CAMERA_ID"))
|
||||
self.mp_drawing = mp.solutions.drawing_utils
|
||||
self.mp_drawing_styles = mp.solutions.drawing_styles
|
||||
self.mp_hands = mp.solutions.hands
|
||||
self.cap = cv2.VideoCapture(0)
|
||||
self.cap = cv2.VideoCapture(self.camera_id)
|
||||
self.hands = self.mp_hands.Hands(
|
||||
model_complexity=0,
|
||||
min_detection_confidence=0.5,
|
||||
@@ -51,8 +56,9 @@ class HandDetector():
|
||||
# To improve performance, optionally mark the image as not writeable to
|
||||
# pass by reference.
|
||||
image.flags.writeable = False
|
||||
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
||||
results = self.hands.process(image)
|
||||
# print(results)
|
||||
|
||||
if results.multi_hand_landmarks:
|
||||
handsPositions = []
|
||||
for hand_landmarks in results.multi_hand_landmarks:
|
||||
|
||||
Reference in New Issue
Block a user