How milind-mh19/bodypose_gamecontroller works
Project Type and Purpose
• This is a single‐host, full-application script that performs real-time pose detection on webcam input, classifies four gestures (left, right, jump, crouch), and injects keyboard events to control the Subway Surfer game.
Main Components
Break the code into these logical pieces (even if they live in app.py for now):
a. Input Source
• Webcam (OpenCV capture)
b. Pose Detection Engine
• MediaPipe Body Pose model
• Frame preprocessing (resizing, normalization)
c. Gesture Classifier & Mapping
• Simple rule-based logic to decide “left”, “right”, “jump”, “crouch”
d. Output/Actuator
e. Visualization & Logging (optional)
• Matplotlib for debugging plots, console logging
Relationships & Data Flow
User’s body → Webcam frame stream → Pose Detection → Gesture Classification → Keyboard Event → Subway Surfer Game
Architectural Patterns & Principles
• Pipeline pattern: data flows from capture → processing → action
• Single responsibility for each logical module (capture vs. detection vs. actuation)
• Separation of concerns sets you up to refactor into multiple files or even microservices later if needed.
Technologies & Frameworks
• OpenCV (camera capture, image preprocessing)
• MediaPipe (pose estimation graph)
• PyAutoGUI (keyboard automation)
• Matplotlib (optional debugging)
Final Checklist
• Clear, self-explanatory labels on components (e.g., “Pose Detector (MediaPipe)”)