Files
crumbmissions/snake_camera_vision_v2/gestures/gestures_debug_test.py
Branko May Trinkwald 2915828adf Add complete Crumbforest mission system
- Interactive mission selector with metadata-driven design
- 5 educational missions (basics + advanced)
- AI assistant roles (Deepbit, Bugsy, Schnippsi, Tobi)
- SnakeCam gesture recognition system
- Token tracking utilities
- CLAUDE.md documentation
- .gitignore for logs and secrets
2025-12-21 01:16:48 +01:00

30 lines
786 B
Python
Executable File

import cv2
import numpy as np
def detect_hand_gesture(frame):
x, y, w, h = 100, 100, 200, 150
roi = frame[y:y+h, x:x+w]
hsv = cv2.cvtColor(roi, cv2.COLOR_BGR2HSV)
# Hautfarbe grob einschränken
lower_skin = np.array([0, 30, 60], dtype=np.uint8)
upper_skin = np.array([20, 150, 255], dtype=np.uint8)
mask = cv2.inRange(hsv, lower_skin, upper_skin)
mask = cv2.GaussianBlur(mask, (5, 5), 0)
contours, _ = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
gesture = "none"
if contours:
contour = max(contours, key=cv2.contourArea)
area = cv2.contourArea(contour)
if area > 3000:
print(f"[debug] Fläche erkannt: {int(area)}")
gesture = "hand"
return gesture, (x, y, w, h)