A real-time webcam-based gesture recognition application that triggers specific reaction images based on user gestures. Built with OpenCV and MediaPipe.
- Real-time Detection: Uses MediaPipe Hands and Face Mesh for low-latency recognition.
- Smart Logic: Distinguishes between similar gestures (e.g., "Think" vs "Idea") using geometric heuristics.
- Visual Feedback: visualizes hand landmarks, face targets, and recognition status.
-
Prerequisites
- Python 3.7+
- A webcam
-
Install Dependencies
pip install opencv-python mediapipe numpy
-
Navigate to the project directory:
cd gesture-detection -
Run the application:
python main.py
-
Controls:
- Press
qto quit the application.
- Press
The system recognizes the following gestures and displays a corresponding image:
| Gesture | Action / Description |
|---|---|
| Default | No specific gesture detected. |
| Think | Place your index finger to your temple or near your mouth. (Requires index finger extended, others curled, hand close to face) |
| Idea | Raise your index finger vertically. (Requires strict vertical index finger, thumb tucked) |
| Mad | Fold your arms across your chest (make fists). (Requires wrists crossed low, fingers curled) |
| Scared | Option 1: Raise both hands open near your face (Home Alone style). Option 2: Clasp hands together below your neck. |
| Tongue | Stick your tongue out. (Requires mouth open and tongue color detection) |
| Double | Two faces detected in the frame. |
- Lighting: Ensure your face and hands are well-lit for accurate detection.
- Camera: If the camera doesn't open, check if another application is using it.
- Performance: The app is optimized for performance (30 FPS target), but older hardware may experience lag.