A real-time gesture detection application that captures camera feed and plays the scuba cat meme when you perform the scuba cat gesture!
- Real-time gesture detection using MediaPipe hand tracking
- Automatic video playback when gesture is detected
- Gesture recognition for scuba cat movement (left hand on face + right hand scooping motion)
- Webcam integration with live feedback
- Cooldown system to prevent multiple rapid triggers
- Python 3.8+
- Webcam/Camera
- Scuba cat meme video file (MP4, AVI, MOV, or MKV)
-
Clone or download this project
-
Install required dependencies:
pip install -r requirements.txt- Add your scuba cat meme video:
- Place your video file in the
assets/folder - Name it
scuba_cat.mp4(or editmain.pyline 13 with your filename)
- Place your video file in the
- Run the application:
python main.py-
Perform the scuba cat gesture:
- Put your LEFT hand near your mouth/face area
- Move your RIGHT hand in a scooping motion
- Hold the gesture for about 0.3 seconds
- The scuba cat meme will play!
-
Controls:
- Press
qto quit the application - Press
pto manually play the video (for testing)
- Press
scuba cat/
├── main.py # Main application
├── gesture_detector.py # Hand gesture detection logic
├── video_player.py # Video playback handler
├── requirements.txt # Python dependencies
├── README.md # This file
└── assets/
└── scuba_cat.mp4 # Your scuba cat meme video (add this)
The gesture detector uses Google's MediaPipe library to track hand positions in real-time:
- Left Hand Detection: Checks if left hand is in the face/mouth region
- Right Hand Movement: Detects motion in the right hand (scooping gesture)
- Confirmation: Requires the gesture to be held for ~10 frames (~0.3 seconds) before triggering
- Cooldown: Prevents multiple rapid triggers (2-second cooldown)
- GestureDetector: Analyzes hand landmarks to identify the scuba cat gesture
- VideoPlayer: Handles video playback in a separate thread for smooth operation
- Main Loop: Captures camera frames, detects gestures, and manages UI
- Check that your webcam is connected and working
- Try changing
CAMERA_INDEXinmain.py(0 for default, 1, 2, etc. for other cameras)
- Ensure good lighting conditions
- The detector works best with clear hand visibility
- Try adjusting the
min_detection_confidenceingesture_detector.py(line 14) - Lower values = more sensitive but less accurate
- Verify the video file exists in
assets/folder - Check the file format (MP4, AVI, MOV, MKV supported)
- Try using a different video format or converting it
- Reduce camera resolution in
main.py - Comment out the landmark drawing line for better performance
- Close other applications consuming CPU/GPU
Edit the detect_scuba_cat_gesture() method in gesture_detector.py to detect different hand movements
required_framesinGestureDetector.__init__(): How long gesture must be held (default: 10 frames)cooldown_framesinmain.py: Delay between consecutive triggers (default: 60 frames)min_detection_confidenceingesture_detector.py: Hand detection confidence threshold (0-1)
Update VIDEO_PATH in main.py to point to your custom video file
- Lighting: Good lighting helps hand detection
- Distance: Keep hands 1-2 feet from camera
- Movement: Make smooth, deliberate gestures
- Patience: The gesture needs to be held for a moment (~0.3 seconds)
Free to use and modify for personal projects.