Skip to content

VenkataSatyaSai16/POSE-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿคธ POSE AI โ€” Real-Time Pose Battle Game

Strike the pose. Beat your opponent. Win the round.

Python OpenCV MediaPipe License

A two-player pose matching game powered by MediaPipe's BlazePose and OpenCV. Players compete side-by-side in front of a single webcam, striking target poses as fast and accurately as they can. An AI judge scores each round in real time based on joint-angle similarity.


โœจ Features

Feature Description
๐ŸŽฎ Two-Player Split-Screen Single webcam divided into two halves โ€” Player 1 (left) & Player 2 (right)
๐Ÿฆด Real-Time Skeleton Tracking Full-body pose estimation via MediaPipe BlazePose (33 landmarks)
๐Ÿ“ Joint-Angle Scoring 8 key joint angles compared against target poses for precise scoring
๐ŸŽฏ 20+ Target Poses Curated library including dance, yoga, bodybuilding & fun poses
๐Ÿ–ฅ๏ธ Responsive HUD Modern gradient UI with live scores, round info & performance feedback
๐Ÿ† Performance Feedback Instant ratings โ€” "Perfect Pose!", "Almost There!", or "What was that pose?"
๐Ÿ”„ Replay System Instantly restart a new game after the winner is announced

๐ŸŽฌ How It Works

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    WEBCAM FEED                       โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  โ”‚  PLAYER 1    โ”‚          โ”‚  PLAYER 2    โ”‚         โ”‚  โ”‚  TARGET    โ”‚
โ”‚  โ”‚  (Left Half) โ”‚          โ”‚ (Right Half) โ”‚         โ”‚  โ”‚   POSE     โ”‚
โ”‚  โ”‚              โ”‚          โ”‚              โ”‚         โ”‚  โ”‚            โ”‚
โ”‚  โ”‚  ๐Ÿฆด Skeleton โ”‚          โ”‚  ๐Ÿฆด Skeleton โ”‚         โ”‚  โ”‚   ๐Ÿ–ผ๏ธ Image โ”‚
โ”‚  โ”‚   Overlay    โ”‚          โ”‚   Overlay    โ”‚         โ”‚  โ”‚            โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                โ”‚
โ”‚              โ”‚    SCORE HUD BAR     โ”‚                โ”‚
โ”‚              โ”‚  P1: 87.3  P2: 72.1  โ”‚                โ”‚
โ”‚              โ”‚   Round 3/5          โ”‚                โ”‚
โ”‚              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  1. Countdown โ€” Each round starts with a 5-second timer
  2. Pose โ€” When the timer hits zero, your current body pose is captured
  3. Score โ€” Joint angles are extracted and compared to the target pose
  4. Repeat โ€” 5 rounds per game, highest total score wins

๐Ÿš€ Getting Started

Prerequisites

  • Python 3.11 (recommended โ€” best MediaPipe compatibility)
  • A working webcam
  • Windows / macOS / Linux

Installation

# Clone the repository
git clone https://github.com/VenkataSatyaSai16/POSE-AI.git
cd POSE-AI

# Create a virtual environment
python -m venv venv

# Activate it
# Windows
venv\Scripts\activate
# macOS / Linux
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

Run the Game

python main.py

๐ŸŽฎ Controls

Key Action
Space Start the game from the title screen
R Restart after game over
Q Quit the game

๐Ÿ“ Project Structure

POSE-AI/
โ”œโ”€โ”€ main.py              # ๐ŸŽฌ Entry point โ€” game loop & state machine
โ”œโ”€โ”€ camera.py            # ๐Ÿ“ท Webcam capture manager
โ”œโ”€โ”€ pose_detector.py     # ๐Ÿฆด MediaPipe BlazePose wrapper
โ”œโ”€โ”€ pose_compare.py      # ๐Ÿ“ Joint angle extraction & scoring engine
โ”œโ”€โ”€ game_logic.py        # ๐ŸŽฎ Round management, scoring & pose loading
โ”œโ”€โ”€ ui.py                # ๐Ÿ–ฅ๏ธ HUD, overlays & responsive UI rendering
โ”œโ”€โ”€ pose_targets.json    # ๐ŸŽฏ Pre-computed target angles per pose
โ”œโ”€โ”€ test.py              # ๐Ÿงช Test script
โ”œโ”€โ”€ requirements.txt     # ๐Ÿ“ฆ Python dependencies
โ””โ”€โ”€ poses/               # ๐Ÿ–ผ๏ธ Target pose image library
    โ”œโ”€โ”€ Bharatanatyam.jpeg
    โ”œโ”€โ”€ bodybuilderpose.jpg
    โ”œโ”€โ”€ treepose1.jpeg
    โ”œโ”€โ”€ michael.webp
    โ”œโ”€โ”€ shahrukh.webp
    โ””โ”€โ”€ ... (20+ poses)

๐Ÿง  How Scoring Works

The game compares 8 key joint angles between the player's pose and the target:

Left Elbow  โ”€โ”                    โ”Œโ”€ Right Elbow
Left Shoulderโ”€โ”ค   ๐Ÿฆด Body Model   โ”œโ”€ Right Shoulder
Left Hip     โ”€โ”ค                    โ”œโ”€ Right Hip
Left Knee    โ”€โ”˜                    โ””โ”€ Right Knee

Formula:

Score = 100 - mean(|player_angle - target_angle| for each joint)
Score Range Feedback
85 โ€“ 100 โญ Perfect Pose!
60 โ€“ 84 ๐Ÿ‘ Almost There!
0 โ€“ 59 ๐Ÿ˜… What was that pose?

๐Ÿ–ผ๏ธ Pose Library

The game ships with 20+ diverse poses spanning multiple categories:

Category Poses
๐Ÿ’ƒ Dance Bharatanatyam, Classical, Dance Pose 1 & 2
๐Ÿง˜ Yoga Tree Pose, Child Pose, Head Down
๐Ÿ’ช Fitness Bodybuilder Pose, Squat Pose
๐Ÿ•บ Pop Culture Michael (Jackson), Shahrukh (Khan), Dab Pose
๐ŸŽ‰ Fun Fun, Kick, Stylish, Show Them

Adding your own poses: Drop any image (.jpg, .jpeg, .png, .webp, .avif) into the poses/ folder. The game will automatically detect the pose in the image and use it as a target. For fine-tuned control, add custom angles in pose_targets.json.


โš™๏ธ Configuration

Setting Location Default
Rounds per game main.py โ†’ TOTAL_ROUNDS 5
Countdown duration main.py โ†’ COUNTDOWN_SECONDS 5.0s
Result display time main.py โ†’ RESULT_SHOW_SECONDS 2.5s
Window size main.py โ†’ cv2.resizeWindow() 1280ร—720
Camera index camera.py โ†’ CameraManager() 0
Pose detection confidence pose_detector.py 0.5

๐Ÿ› ๏ธ Tech Stack

  • MediaPipe โ€” Google's ML framework for real-time pose estimation (BlazePose, 33 landmarks)
  • OpenCV โ€” Computer vision library for camera capture, image processing & UI rendering
  • NumPy โ€” Efficient numerical computation for angle calculations

๐Ÿค Contributing

Contributions are welcome! Here are some ideas:

  • ๐ŸŒ Add a web-based UI with Flask/Streamlit
  • ๐Ÿ“ฑ Mobile support via MediaPipe's lightweight models
  • ๐ŸŽต Background music & sound effects
  • ๐Ÿ“Š Score history & leaderboard persistence
  • ๐Ÿค– Single-player mode with AI opponent
  • ๐ŸŽจ Custom pose creation tool
# Fork & clone
git clone https://github.com/<your-username>/POSE-AI.git

# Create a feature branch
git checkout -b feature/amazing-feature

# Commit & push
git commit -m "Add amazing feature"
git push origin feature/amazing-feature

# Open a Pull Request ๐ŸŽ‰

๐Ÿ“ License

This project is open source and available under the MIT License.


Built with โค๏ธ and AI

โญ Star this repo if you like it!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors