Real-time foreground/background segmentation using Gaussian Mixture Models (GMM)
Based on Stauffer & Grimson (CVPR 1999 / PAMI 2000)
Try it now: https://jahnaviisingh.github.io/cyber-vision/
This web app uses your camera to detect moving objects in real time β just like how security cameras work!
| Panel | What You See |
|---|---|
| π· Original | Your live camera feed |
| βͺ FG Mask | Moving objects in white, background in black |
| π¨ Foreground | Moving objects in original color on black |
| ποΈ Background | Reconstructed static scene (what the camera thinks is "normal") |
Each pixel is modeled as a mixture of K Gaussian distributions. The algorithm:
- Learns what "normal" looks like over time
- Compares each new pixel against learned models
- Flags pixels that don't match as foreground (movement)
- Adapts continuously to lighting changes
| Parameter | What It Does |
|---|---|
| Ξ± (Learning Rate) | How fast the model adapts to changes |
| K (Gaussians) | How many "layers" of background it remembers |
| T (Match Threshold) | How sensitive the detection is |
| B (Background Ratio) | How many components form the background |
- Vanilla JavaScript β No frameworks, pure implementation
- HTML5 Canvas β Real-time video rendering
- MediaDevices API β Camera access
- Custom GMM β Implemented from scratch (no libraries)
- Stauffer, C. & Grimson, W.E.L. (1999). Adaptive Background Mixture Models for Real-Time Tracking. CVPR.
- Stauffer, C. & Grimson, W.E.L. (2000). Learning Patterns of Activity Using Real-Time Tracking. PAMI.
Jahnavi Singh
MIT