Welcome to Subway Surf with Python! An interactive Computer Vision application that lets you play Subway Surfers using physical hand gestures in real-time. Built using OpenCV, MediaPipe, and AI-assisted gesture mapping algorithms to replace traditional keyboard controls with natural hand movements.
- 🖐️ Real-Time Hand Landmark Detection: Tracks 21 hand knuckles with high precision using MediaPipe.
- 🕹️ Dynamic Gesture Mapping: Maps physical hand positions (jump, crouch/roll, lane shift left, lane shift right) directly to virtual keyboard inputs.
- ⚡ Low-Latency Game Control: Optimized frame processing loop to ensure instant response time during gameplay.
- 🎥 Live Camera Overlay: Visual feedback showing tracked landmarks and current gesture state directly on the screen.
- 🤖 AI-Enhanced Architecture: Built with AI assistance to refine distance calculations and gesture recognition accuracy.
- Language: Python 3.x
- Computer Vision: OpenCV (
cv2) - Gesture Tracking: MediaPipe Hands
- Keyboard Automation: PyAutoGUI
- Mathematical Operations: NumPy
Follow these steps to set up and run the project locally on your machine.
Make sure you have installed:
- Python >= 3.8
pip(Python Package Installer)- A working Webcam
-
Clone the repository:
git clone https://github.com/Madtch/subwaysurfwithpython.git cd subwaysurfwithpython -
Set up a Virtual Environment (Optional but recommended):
python -m venv venv # On Windows: venv\Scripts\activate # On macOS/Linux: source venv/bin/activate
-
Install Dependencies:
pip install opencv-python mediapipe pyautogui numpy
-
Run the Application:
python subwaysurf.py
-
Start Playing:
- Open Subway Surfers (via Web Browser or Emulator).
- Ensure your webcam captures your hand clearly.
- Move your hands to trigger in-game movements!
Zamzami Ahmad
- GitHub: @Madtch
Developed with modern Computer Vision standards to showcase real-time gesture recognition and Human-Computer Interaction (HCI).