Skip to content

About

An interactive computer vision application that detects arm motion using your webcam and displays a floating video panel when movement is detected.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arms Detector

An interactive computer vision application that detects arm motion using your webcam and displays a floating video panel when movement is detected.

Python OpenCV MediaPipe

Features

  • Real-time arm motion detection using MediaPipe Pose landmarks
  • Fallback motion detection via OpenCV when MediaPipe is unavailable
  • Floating video panel that appears when arm movement is detected
  • Cross-platform camera support with Windows DirectShow/MediaFoundation backends
  • Adjustable sensitivity on the fly with keyboard controls
  • Visual HUD showing motion levels and detection status
  • Skeleton overlay for visual feedback on tracking

Demo

When you move your arms, a floating video panel appears in the corner of the screen. The panel hides when you stop moving.

Installation

Requirements

  • Python 3.8 or higher
  • Webcam

Dependencies

pip install opencv-python mediapipe

Usage

Basic Usage

python main.py --video myclip.mp4

Command Line Options

python main.py --video <path> [--sensitivity <value>] [--camera <index>]
Option Description Default
--video Path to the video file to display Required
--sensitivity Motion threshold (lower = more sensitive) 0.04
--camera Camera device index 0

Examples

# Use default camera with a video file
python main.py --video tutorial.mp4

# Use a specific camera and higher sensitivity
python main.py --video workout.mp4 --camera 1 --sensitivity 0.02

# Less sensitive (requires more movement to trigger)
python main.py --video demo.mp4 --sensitivity 0.08

Controls

Key Action
Q or ESC Quit the application
+ Increase sensitivity (lower threshold)
- Decrease sensitivity (higher threshold)

How It Works

  1. Camera Capture: Opens your webcam with optimized settings for real-time processing
  2. Motion Detection:
    • Uses MediaPipe Pose to track wrist positions relative to shoulders
    • Falls back to OpenCV motion detection in side bands if MediaPipe unavailable
  3. Smart Triggering:
    • Calculates torso-relative wrist movement to ignore body sway
    • Applies smoothing over multiple frames to reduce false positives
  4. Video Overlay: Displays a floating "Now Playing" panel when motion exceeds threshold

Project Structure

hands-detecter/
├── main.py          # Main application code
├── myclip.mp4       # Sample video file
└── README.md        # This file

Troubleshooting

Camera not detected

  • Check Windows camera privacy settings
  • Try a different camera index: --camera 1
  • Ensure no other application is using the camera

Black frames

  • The app will automatically try different camera backends
  • Check if your camera works in other applications
  • Try adjusting room lighting

High CPU usage

  • Lower the camera resolution in main.py (change PANEL_W, PANEL_H)
  • Use a lower frame rate video file

Technical Details

  • Primary tracking: MediaPipe Pose landmarks (wrists, shoulders, nose)
  • Fallback tracking: OpenCV optical flow in side ROI bands
  • Smoothing: 6-frame rolling average for wrist positions
  • Threading: Separate threads for camera and video file reading
  • Platforms: Windows (DirectShow/MediaFoundation), Linux, macOS

License

MIT License - feel free to use and modify as needed.

Author

Created by GitMehdi-sys

About

An interactive computer vision application that detects arm motion using your webcam and displays a floating video panel when movement is detected.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages