An interactive computer vision application that detects arm motion using your webcam and displays a floating video panel when movement is detected.
- 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
When you move your arms, a floating video panel appears in the corner of the screen. The panel hides when you stop moving.
- Python 3.8 or higher
- Webcam
pip install opencv-python mediapipepython main.py --video myclip.mp4python 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 |
# 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| Key | Action |
|---|---|
Q or ESC |
Quit the application |
+ |
Increase sensitivity (lower threshold) |
- |
Decrease sensitivity (higher threshold) |
- Camera Capture: Opens your webcam with optimized settings for real-time processing
- Motion Detection:
- Uses MediaPipe Pose to track wrist positions relative to shoulders
- Falls back to OpenCV motion detection in side bands if MediaPipe unavailable
- Smart Triggering:
- Calculates torso-relative wrist movement to ignore body sway
- Applies smoothing over multiple frames to reduce false positives
- Video Overlay: Displays a floating "Now Playing" panel when motion exceeds threshold
hands-detecter/
├── main.py # Main application code
├── myclip.mp4 # Sample video file
└── README.md # This file
- Check Windows camera privacy settings
- Try a different camera index:
--camera 1 - Ensure no other application is using the camera
- The app will automatically try different camera backends
- Check if your camera works in other applications
- Try adjusting room lighting
- Lower the camera resolution in
main.py(changePANEL_W,PANEL_H) - Use a lower frame rate video file
- 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
MIT License - feel free to use and modify as needed.
Created by GitMehdi-sys