diff --git a/README.md b/README.md index 9739191..7dc09af 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ GestureX enables you to control your Linux PC using hand gestures. You can assig ## Features -- Recognizes hand gestures using a webcam -- Maps hand gestures to custom commands or functionalities +- Recognizes hand gestures and maps hand gestures to custom commands using a webcam - Real-time preview of webcam feed with hand gesture recognition +- Supports multiple camera sources - Easily configurable through a graphical user interface ## Installation diff --git a/gui.py b/gui.py index 3bb75e5..ca982f2 100644 --- a/gui.py +++ b/gui.py @@ -4,7 +4,7 @@ from gi.repository import Gtk, GdkPixbuf, Gdk, GLib import cv2 import numpy as np import mediapipe as mp -from tensorflow.keras.models import load_model +from keras.models import load_model import threading import os import json @@ -262,9 +262,6 @@ class Main(Gtk.Window): GLib.idle_add(self.update_video_widget, pixbuf) - else: - break - def update_video_widget(self, pixbuf): self.video_widget.set_from_pixbuf(pixbuf) return False @@ -356,16 +353,15 @@ class Main(Gtk.Window): if cap.isOpened(): camera_sources.append(i) cap.release() - else: - break return camera_sources def on_camera_source_changed(self, combo): active_text = combo.get_active_text() if active_text: camera_index = int(active_text.split()[-1]) - self.cap.release() # Release the previous camera - self.cap = cv2.VideoCapture(camera_index) # Open the new camera + if self.cap.isOpened(): + self.cap.release() + self.cap = cv2.VideoCapture(camera_index) def update_cooldown(self, widget): cooldown = self.cooldown_textbox.get_text()