A real-time hand tracking system built using:
- ๐ฅ OpenCV (camera processing)
- ๐ MediaPipe (hand landmark detection)
- ๐งฎ NumPy (math utilities)
This project detects hand landmarks from a webcam feed and enables gesture-based interaction like pinch detection and finger counting.
- Real-time webcam hand tracking
- 21 hand landmark detection
- Pinch detection (Thumb + Index)
- Finger counting logic
- Gesture recognition foundation
- Lightweight and fast
MediaPipe detects 21 3D hand landmarks per frame.
Example important landmarks:
- 0 โ Wrist
- 4 โ Thumb tip
- 8 โ Index tip
- 12 โ Middle tip
- 16 โ Ring tip
- 20 โ Pinky tip
Pinch detection is calculated using the distance between:
Thumb tip (4) and Index tip (8)
If the distance is small โ pinch detected.
| Gesture | Detection Logic |
|---|---|
| ๐ค Pinch | Distance(4, 8) < threshold |
| โ Fist | No fingers up |
| โ Open Palm | 4 fingers up |
| โ Index Up | Landmark 8 above landmark 6 |
Finger up detection logic:
tip.y < pip.y
## Installations
pip install opencv-python mediapipe numpy