änderung von Spiel und Gesteerkennung
This commit is contained in:
parent
32351334d9
commit
4ed8120690
@ -28,7 +28,6 @@ def start_osc_server():
|
|||||||
disp.map("/touch", osc_touch)
|
disp.map("/touch", osc_touch)
|
||||||
disp.map("/clap", osc_clap)
|
disp.map("/clap", osc_clap)
|
||||||
|
|
||||||
# ⚠ Port an deine Gesture-App anpassen:
|
|
||||||
# Dein gesture_input_osc sendet an 127.0.0.1:5005 → hier auch 5005
|
# Dein gesture_input_osc sendet an 127.0.0.1:5005 → hier auch 5005
|
||||||
server = osc_server.ThreadingOSCUDPServer(("127.0.0.1", 5005), disp)
|
server = osc_server.ThreadingOSCUDPServer(("127.0.0.1", 5005), disp)
|
||||||
print("🔊 OSC server läuft auf Port 5005")
|
print("🔊 OSC server läuft auf Port 5005")
|
||||||
@ -103,12 +102,10 @@ class MemoryGame:
|
|||||||
self.pair_count = 6
|
self.pair_count = 6
|
||||||
self.player_mode = 2
|
self.player_mode = 2
|
||||||
|
|
||||||
# Confirmation phase
|
# "Bestätigungsphase" = wir warten auf Klatschen
|
||||||
self.awaiting_confirmation = False
|
self.awaiting_confirmation = False
|
||||||
self.confirmation_result = None
|
|
||||||
self.correct_answer_expected = None
|
|
||||||
self.confirmation_start_time = None
|
self.confirmation_start_time = None
|
||||||
self.confirmation_time_limit = 5
|
self.confirmation_time_limit = 5 # Sekunden
|
||||||
|
|
||||||
# Visuals
|
# Visuals
|
||||||
self.card_back = None
|
self.card_back = None
|
||||||
@ -169,6 +166,8 @@ class MemoryGame:
|
|||||||
self.found_pairs = 0
|
self.found_pairs = 0
|
||||||
self.current_player = 0
|
self.current_player = 0
|
||||||
self.scores = [0, 0]
|
self.scores = [0, 0]
|
||||||
|
self.awaiting_confirmation = False
|
||||||
|
self.confirmation_start_time = None
|
||||||
|
|
||||||
cols = 4
|
cols = 4
|
||||||
rows = (len(self.cards) + cols - 1) // cols
|
rows = (len(self.cards) + cols - 1) // cols
|
||||||
@ -214,6 +213,11 @@ class MemoryGame:
|
|||||||
screen.blit(title, (20, 20))
|
screen.blit(title, (20, 20))
|
||||||
screen.blit(score_text, (20, 50))
|
screen.blit(score_text, (20, 50))
|
||||||
|
|
||||||
|
# Hinweis: wenn 2 Karten offen sind, warte auf Clap
|
||||||
|
if self.awaiting_confirmation and len(self.selected) == 2:
|
||||||
|
hint = self.small_font.render("👏 Klatschen, um das Paar zu bestätigen!", True, (255, 255, 0))
|
||||||
|
screen.blit(hint, (SCREEN_WIDTH // 2 - hint.get_width() // 2, 80))
|
||||||
|
|
||||||
for i, rect in enumerate(self.card_rects):
|
for i, rect in enumerate(self.card_rects):
|
||||||
if self.matched[i]:
|
if self.matched[i]:
|
||||||
pygame.draw.rect(screen, MATCH_COLOR, rect)
|
pygame.draw.rect(screen, MATCH_COLOR, rect)
|
||||||
@ -233,34 +237,13 @@ class MemoryGame:
|
|||||||
)
|
)
|
||||||
screen.blit(label, label.get_rect(center=(rect.centerx, rect.centery + 20)))
|
screen.blit(label, label.get_rect(center=(rect.centerx, rect.centery + 20)))
|
||||||
|
|
||||||
if self.awaiting_confirmation:
|
|
||||||
self.draw_confirmation_box(screen)
|
|
||||||
|
|
||||||
pygame.display.flip()
|
pygame.display.flip()
|
||||||
|
|
||||||
def draw_confirmation_box(self, screen):
|
|
||||||
box = pygame.Rect(SCREEN_WIDTH // 2 - 150, SCREEN_HEIGHT // 2 - 320, 300, 160)
|
|
||||||
pygame.draw.rect(screen, (250, 250, 250), box)
|
|
||||||
pygame.draw.rect(screen, (0, 0, 0), box, 3)
|
|
||||||
text = self.font.render("Is that correct?", True, (0, 0, 0))
|
|
||||||
screen.blit(text, (box.centerx - text.get_width() // 2, box.y + 20))
|
|
||||||
|
|
||||||
elapsed = time.time() - self.confirmation_start_time
|
|
||||||
remaining = max(0, self.confirmation_time_limit - elapsed)
|
|
||||||
timer = self.small_font.render(f"{remaining:.1f}s left", True, (150, 0, 0))
|
|
||||||
screen.blit(timer, (box.centerx - timer.get_width() // 2, box.y + 60))
|
|
||||||
|
|
||||||
self.yes_rect = pygame.Rect(box.x + 50, box.y + 90, 80, 40)
|
|
||||||
self.no_rect = pygame.Rect(box.x + 170, box.y + 90, 80, 40)
|
|
||||||
pygame.draw.rect(screen, (0, 200, 0), self.yes_rect)
|
|
||||||
pygame.draw.rect(screen, (200, 0, 0), self.no_rect)
|
|
||||||
screen.blit(self.font.render("Yes", True, (255, 255, 255)), self.yes_rect.move(20, 5))
|
|
||||||
screen.blit(self.font.render("No", True, (255, 255, 255)), self.no_rect.move(25, 5))
|
|
||||||
|
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# Interaction Logic
|
# Interaction Logic
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
def handle_click(self, pos):
|
def handle_click(self, pos):
|
||||||
|
# Menüs: mit Touch durchklicken
|
||||||
if self.state in ["mode", "continent", "americas", "difficulty", "pairs", "timer"]:
|
if self.state in ["mode", "continent", "americas", "difficulty", "pairs", "timer"]:
|
||||||
for rect, option in self.buttons:
|
for rect, option in self.buttons:
|
||||||
if rect.collidepoint(pos):
|
if rect.collidepoint(pos):
|
||||||
@ -297,12 +280,11 @@ class MemoryGame:
|
|||||||
self.setup_game()
|
self.setup_game()
|
||||||
self.state = "game"
|
self.state = "game"
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Spiel: Karten nur anklicken, wenn wir NICHT gerade auf Clap warten
|
||||||
elif self.state == "game":
|
elif self.state == "game":
|
||||||
if self.awaiting_confirmation:
|
if self.awaiting_confirmation or len(self.selected) >= 2:
|
||||||
if self.yes_rect.collidepoint(pos):
|
# Während wir auf Klatschen warten, keine weiteren Karten öffnen
|
||||||
self.confirmation_result = "yes"
|
|
||||||
elif self.no_rect.collidepoint(pos):
|
|
||||||
self.confirmation_result = "no"
|
|
||||||
return
|
return
|
||||||
|
|
||||||
for i, rect in enumerate(self.card_rects):
|
for i, rect in enumerate(self.card_rects):
|
||||||
@ -318,19 +300,49 @@ class MemoryGame:
|
|||||||
"""Verarbeite die aktuellen OSC-Eingaben (Touch & Clap)."""
|
"""Verarbeite die aktuellen OSC-Eingaben (Touch & Clap)."""
|
||||||
global touch_x, touch_y, clap_trigger
|
global touch_x, touch_y, clap_trigger
|
||||||
|
|
||||||
# TOUCH: als Klick ins Spiel
|
# TOUCH: als Klick ins Spiel (Menü oder Karte)
|
||||||
if touch_x is not None and touch_y is not None:
|
if touch_x is not None and touch_y is not None:
|
||||||
pos = (int(touch_x), int(touch_y))
|
pos = (int(touch_x), int(touch_y))
|
||||||
self.handle_click(pos)
|
self.handle_click(pos)
|
||||||
# Reset, damit es nicht mehrfach feuert
|
touch_x, touch_y = None, None # Reset
|
||||||
touch_x, touch_y = None, None
|
|
||||||
|
|
||||||
# CLAP: bestätige "Yes", wenn wir gerade fragen
|
# CLAP: wenn 2 Karten offen und wir warten → Paar auswerten
|
||||||
if clap_trigger:
|
if clap_trigger:
|
||||||
if self.awaiting_confirmation and self.confirmation_result is None:
|
if self.awaiting_confirmation and len(self.selected) == 2:
|
||||||
self.confirmation_result = "yes"
|
self.resolve_pair()
|
||||||
clap_trigger = False
|
clap_trigger = False
|
||||||
|
|
||||||
|
# -------------------------------
|
||||||
|
# Paar auswerten (nach Clap oder Timeout)
|
||||||
|
# -------------------------------
|
||||||
|
def resolve_pair(self):
|
||||||
|
"""Prüft das aktuelle Kartenpaar und aktualisiert Punkte / Spieler."""
|
||||||
|
if len(self.selected) != 2:
|
||||||
|
return
|
||||||
|
|
||||||
|
a, b = self.selected
|
||||||
|
text_a = self.cards[a]["text"]
|
||||||
|
text_b = self.cards[b]["text"]
|
||||||
|
is_match = self.pair_map.get(text_a) == text_b
|
||||||
|
|
||||||
|
if is_match:
|
||||||
|
self.matched[a] = self.matched[b] = True
|
||||||
|
self.scores[self.current_player] += 1
|
||||||
|
self.found_pairs += 1
|
||||||
|
else:
|
||||||
|
# Falsches Paar: Karten wieder umdrehen, Punkt abziehen
|
||||||
|
self.revealed[a] = self.revealed[b] = False
|
||||||
|
self.scores[self.current_player] -= 1
|
||||||
|
|
||||||
|
# Reset für nächste Runde
|
||||||
|
self.selected = []
|
||||||
|
self.awaiting_confirmation = False
|
||||||
|
self.confirmation_start_time = None
|
||||||
|
|
||||||
|
# Spielerwechsel immer nach einem Paar (wie vorher)
|
||||||
|
if self.player_mode == 2:
|
||||||
|
self.current_player = 1 - self.current_player
|
||||||
|
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# Game Logic
|
# Game Logic
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
@ -338,47 +350,22 @@ class MemoryGame:
|
|||||||
if self.state != "game":
|
if self.state != "game":
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Wenn zwei Karten offen sind → Warte auf Clap
|
||||||
if len(self.selected) == 2 and not self.awaiting_confirmation:
|
if len(self.selected) == 2 and not self.awaiting_confirmation:
|
||||||
a, b = self.selected
|
|
||||||
text_a = self.cards[a]["text"]
|
|
||||||
text_b = self.cards[b]["text"]
|
|
||||||
is_match = self.pair_map.get(text_a) == text_b
|
|
||||||
self.correct_answer_expected = "yes" if is_match else "no"
|
|
||||||
self.awaiting_confirmation = True
|
self.awaiting_confirmation = True
|
||||||
self.confirmation_start_time = time.time()
|
self.confirmation_start_time = time.time()
|
||||||
|
|
||||||
# Timeout logic
|
# Timeout: wenn zu lange kein Clap → Karten zurückdrehen, Spielerwechsel
|
||||||
if self.awaiting_confirmation and time.time() - self.confirmation_start_time > self.confirmation_time_limit:
|
if self.awaiting_confirmation and self.confirmation_start_time is not None:
|
||||||
a, b = self.selected
|
if time.time() - self.confirmation_start_time > self.confirmation_time_limit:
|
||||||
self.revealed[a] = self.revealed[b] = False
|
if len(self.selected) == 2:
|
||||||
self.awaiting_confirmation = False
|
a, b = self.selected
|
||||||
self.selected = []
|
|
||||||
if self.player_mode == 2:
|
|
||||||
self.current_player = 1 - self.current_player
|
|
||||||
return
|
|
||||||
|
|
||||||
# Player response
|
|
||||||
if self.awaiting_confirmation and self.confirmation_result:
|
|
||||||
a, b = self.selected
|
|
||||||
expected = self.correct_answer_expected
|
|
||||||
player_correct = self.confirmation_result == expected
|
|
||||||
|
|
||||||
if player_correct:
|
|
||||||
if expected == "yes":
|
|
||||||
self.matched[a] = self.matched[b] = True
|
|
||||||
self.scores[self.current_player] += 1
|
|
||||||
self.found_pairs += 1
|
|
||||||
else:
|
|
||||||
self.revealed[a] = self.revealed[b] = False
|
self.revealed[a] = self.revealed[b] = False
|
||||||
else:
|
self.selected = []
|
||||||
self.scores[self.current_player] -= 1
|
self.awaiting_confirmation = False
|
||||||
self.revealed[a] = self.revealed[b] = False
|
self.confirmation_start_time = None
|
||||||
|
if self.player_mode == 2:
|
||||||
self.awaiting_confirmation = False
|
self.current_player = 1 - self.current_player
|
||||||
self.confirmation_result = None
|
|
||||||
self.selected = []
|
|
||||||
if self.player_mode == 2:
|
|
||||||
self.current_player = 1 - self.current_player
|
|
||||||
|
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# Winner Screen
|
# Winner Screen
|
||||||
@ -413,9 +400,10 @@ class MemoryGame:
|
|||||||
for event in pygame.event.get():
|
for event in pygame.event.get():
|
||||||
if event.type == pygame.QUIT:
|
if event.type == pygame.QUIT:
|
||||||
self.running = False
|
self.running = False
|
||||||
elif event.type == pygame.MOUSEBUTTONDOWN:
|
# Maus komplett ignorieren (kein Klick mehr)
|
||||||
# Maus bleibt optional als Eingabe
|
# elif event.type == pygame.MOUSEBUTTONDOWN:
|
||||||
self.handle_click(event.pos)
|
# self.handle_click(event.pos)
|
||||||
|
# Wenn du zum Debuggen Maus willst, obige Zeilen entkommentieren.
|
||||||
|
|
||||||
# 💡 HIER werden jetzt *jeden Frame* die OSC-Eingaben verarbeitet
|
# 💡 HIER werden jetzt *jeden Frame* die OSC-Eingaben verarbeitet
|
||||||
self.process_osc_input()
|
self.process_osc_input()
|
||||||
|
|||||||
@ -1,87 +1,112 @@
|
|||||||
import cv2
|
import cv2
|
||||||
import mediapipe as mp
|
import mediapipe as mp
|
||||||
import json, time, math, numpy as np
|
import numpy as np
|
||||||
|
import math, time
|
||||||
from pythonosc import udp_client
|
from pythonosc import udp_client
|
||||||
|
|
||||||
# Verbindung zum Spiel herstellen
|
# -------------------------------
|
||||||
|
# SETTINGS
|
||||||
|
# -------------------------------
|
||||||
|
TOUCH_CAM_INDEX = 1 # deine Touch-Kamera
|
||||||
|
GESTURE_CAM_INDEX = 0 # deine Clap / Gesture Kamera
|
||||||
|
|
||||||
|
GAME_SCREEN_WIDTH = 900 # muss zu deinem Pygame-Fenster passen!
|
||||||
|
GAME_SCREEN_HEIGHT = 600
|
||||||
|
|
||||||
client = udp_client.SimpleUDPClient("127.0.0.1", 5005)
|
client = udp_client.SimpleUDPClient("127.0.0.1", 5005)
|
||||||
|
|
||||||
# Hilfsfunktion zur Kalibrierung (wie zuvor)
|
# -------------------------------
|
||||||
def map_to_screen(x, y, calib_points, screen_size=(800, 600)):
|
# MAIN FUNCTION
|
||||||
pts_src = np.array(calib_points, dtype=np.float32)
|
# -------------------------------
|
||||||
pts_dst = np.array([
|
def run_gesture_input():
|
||||||
[0, 0],
|
|
||||||
[screen_size[0], 0],
|
|
||||||
[screen_size[0], screen_size[1]],
|
|
||||||
[0, screen_size[1]]
|
|
||||||
], dtype=np.float32)
|
|
||||||
M = cv2.getPerspectiveTransform(pts_src, pts_dst)
|
|
||||||
p = np.array([[[x, y]]], dtype=np.float32)
|
|
||||||
mapped = cv2.perspectiveTransform(p, M)[0][0]
|
|
||||||
return int(mapped[0]), int(mapped[1])
|
|
||||||
|
|
||||||
def run_gesture_input(touch_cam_index=0, gesture_cam_index=1, screen_size=(800, 600)):
|
|
||||||
mp_hands = mp.solutions.hands
|
mp_hands = mp.solutions.hands
|
||||||
mp_draw = mp.solutions.drawing_utils
|
mp_draw = mp.solutions.drawing_utils
|
||||||
|
|
||||||
hands_touch = mp_hands.Hands(max_num_hands=1, min_detection_confidence=0.6)
|
hands_touch = mp_hands.Hands(max_num_hands=1, min_detection_confidence=0.6)
|
||||||
hands_gesture = mp_hands.Hands(max_num_hands=2, min_detection_confidence=0.6)
|
hands_gesture = mp_hands.Hands(max_num_hands=2, min_detection_confidence=0.6)
|
||||||
|
|
||||||
# Kalibrierung laden
|
# Kameras öffnen
|
||||||
try:
|
cam_touch = cv2.VideoCapture(TOUCH_CAM_INDEX)
|
||||||
calib_points = json.load(open("calibration.json"))
|
cam_gesture = cv2.VideoCapture(GESTURE_CAM_INDEX)
|
||||||
print("📄 Kalibrierung geladen:", calib_points)
|
|
||||||
except:
|
if not cam_touch.isOpened():
|
||||||
print("⚠️ Keine calibration.json – zuerst calibrate_touch.py ausführen!")
|
print("❌ Touch-Kamera konnte NICHT geöffnet werden!")
|
||||||
return
|
else:
|
||||||
|
print(f"✅ Touch-Kamera geöffnet (Index {TOUCH_CAM_INDEX})")
|
||||||
|
|
||||||
|
if not cam_gesture.isOpened():
|
||||||
|
print("❌ Gesture-Kamera konnte NICHT geöffnet werden!")
|
||||||
|
else:
|
||||||
|
print(f"✅ Gesture-Kamera geöffnet (Index {GESTURE_CAM_INDEX})")
|
||||||
|
|
||||||
cam_touch = cv2.VideoCapture(touch_cam_index)
|
|
||||||
cam_gesture = cv2.VideoCapture(gesture_cam_index)
|
|
||||||
prev_clap_time = 0
|
prev_clap_time = 0
|
||||||
clap_cooldown = 1.5
|
clap_cooldown = 1.5
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
ok1, frame_touch = cam_touch.read()
|
ok1, frame_touch = cam_touch.read()
|
||||||
ok2, frame_gest = cam_gesture.read()
|
ok2, frame_gest = cam_gesture.read()
|
||||||
|
|
||||||
if not ok1 or not ok2:
|
if not ok1 or not ok2:
|
||||||
print("⚠️ Kamera nicht verfügbar"); break
|
print("⚠️ Eine Kamera liefert kein Bild.")
|
||||||
|
break
|
||||||
|
|
||||||
frame_touch = cv2.flip(frame_touch, 1)
|
frame_touch = cv2.flip(frame_touch, 1)
|
||||||
frame_gest = cv2.flip(frame_gest, 1)
|
frame_gest = cv2.flip(frame_gest, 1)
|
||||||
|
|
||||||
# --- Touch-Erkennung ---
|
# ---------------------------------------
|
||||||
|
# TOUCH (Zeigefinger) ohne Kalibrierung
|
||||||
|
# ---------------------------------------
|
||||||
rgb_t = cv2.cvtColor(frame_touch, cv2.COLOR_BGR2RGB)
|
rgb_t = cv2.cvtColor(frame_touch, cv2.COLOR_BGR2RGB)
|
||||||
res_t = hands_touch.process(rgb_t)
|
res_t = hands_touch.process(rgb_t)
|
||||||
h, w, _ = frame_touch.shape
|
|
||||||
|
th, tw, _ = frame_touch.shape
|
||||||
|
|
||||||
if res_t.multi_hand_landmarks:
|
if res_t.multi_hand_landmarks:
|
||||||
lm = res_t.multi_hand_landmarks[0]
|
lm = res_t.multi_hand_landmarks[0]
|
||||||
mp_draw.draw_landmarks(frame_touch, lm, mp_hands.HAND_CONNECTIONS)
|
mp_draw.draw_landmarks(frame_touch, lm, mp_hands.HAND_CONNECTIONS)
|
||||||
fx = int(lm.landmark[8].x * w)
|
|
||||||
fy = int(lm.landmark[8].y * h)
|
fx = int(lm.landmark[8].x * tw)
|
||||||
sx, sy = map_to_screen(fx, fy, calib_points, screen_size)
|
fy = int(lm.landmark[8].y * th)
|
||||||
|
|
||||||
|
# einfache Skalierung auf dein Spiel-Fenster
|
||||||
|
sx = int(fx * (GAME_SCREEN_WIDTH / tw))
|
||||||
|
sy = int(fy * (GAME_SCREEN_HEIGHT / th))
|
||||||
|
|
||||||
|
# Finger unten? (Touch)
|
||||||
if lm.landmark[8].y > 0.8:
|
if lm.landmark[8].y > 0.8:
|
||||||
client.send_message("/touch", [sx, sy])
|
client.send_message("/touch", [sx, sy])
|
||||||
cv2.putText(frame_touch, f"Touch ({sx},{sy})", (40, 60),
|
cv2.putText(frame_touch, f"Touch {sx},{sy}", (40, 60),
|
||||||
cv2.FONT_HERSHEY_SIMPLEX, 0.8, (0, 255, 0), 2)
|
cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0, 255, 0), 2)
|
||||||
|
|
||||||
# --- Clap-Erkennung ---
|
# ---------------------------------------
|
||||||
|
# CLAP (zwei Hände)
|
||||||
|
# ---------------------------------------
|
||||||
rgb_g = cv2.cvtColor(frame_gest, cv2.COLOR_BGR2RGB)
|
rgb_g = cv2.cvtColor(frame_gest, cv2.COLOR_BGR2RGB)
|
||||||
res_g = hands_gesture.process(rgb_g)
|
res_g = hands_gesture.process(rgb_g)
|
||||||
|
|
||||||
gh, gw, _ = frame_gest.shape
|
gh, gw, _ = frame_gest.shape
|
||||||
|
|
||||||
if res_g.multi_hand_landmarks and len(res_g.multi_hand_landmarks) == 2:
|
if res_g.multi_hand_landmarks and len(res_g.multi_hand_landmarks) == 2:
|
||||||
h1, h2 = res_g.multi_hand_landmarks
|
h1, h2 = res_g.multi_hand_landmarks
|
||||||
|
|
||||||
x1 = np.mean([p.x for p in h1.landmark]) * gw
|
x1 = np.mean([p.x for p in h1.landmark]) * gw
|
||||||
y1 = np.mean([p.y for p in h1.landmark]) * gh
|
y1 = np.mean([p.y for p in h1.landmark]) * gh
|
||||||
x2 = np.mean([p.x for p in h2.landmark]) * gw
|
x2 = np.mean([p.x for p in h2.landmark]) * gw
|
||||||
y2 = np.mean([p.y for p in h2.landmark]) * gh
|
y2 = np.mean([p.y for p in h2.landmark]) * gh
|
||||||
|
|
||||||
dist = math.hypot(x2 - x1, y2 - y1)
|
dist = math.hypot(x2 - x1, y2 - y1)
|
||||||
|
|
||||||
if dist < 100 and (time.time() - prev_clap_time) > clap_cooldown:
|
if dist < 100 and (time.time() - prev_clap_time) > clap_cooldown:
|
||||||
client.send_message("/clap", 1)
|
|
||||||
prev_clap_time = time.time()
|
prev_clap_time = time.time()
|
||||||
cv2.putText(frame_gest, "👏", (int(gw / 2) - 20, 80),
|
client.send_message("/clap", 1)
|
||||||
|
cv2.putText(frame_gest, "👏", (int(gw/2)-20, 80),
|
||||||
cv2.FONT_HERSHEY_SIMPLEX, 2, (0, 255, 255), 3)
|
cv2.FONT_HERSHEY_SIMPLEX, 2, (0, 255, 255), 3)
|
||||||
|
|
||||||
cv2.imshow("Touch-Cam", frame_touch)
|
cv2.imshow("Touch-Cam", frame_touch)
|
||||||
cv2.imshow("Gesture-Cam", frame_gest)
|
cv2.imshow("Gesture-Cam", frame_gest)
|
||||||
|
|
||||||
if cv2.waitKey(5) & 0xFF == 27:
|
if cv2.waitKey(5) & 0xFF == 27:
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -89,5 +114,6 @@ def run_gesture_input(touch_cam_index=0, gesture_cam_index=1, screen_size=(800,
|
|||||||
cam_gesture.release()
|
cam_gesture.release()
|
||||||
cv2.destroyAllWindows()
|
cv2.destroyAllWindows()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
run_gesture_input()
|
run_gesture_input()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user