A highly optimized real-time fire detection system utilizing computer vision, HSV color masking, and dual-layer verification to eliminate false triggers. π¨
- Dual-layer detection β identifies both the orange/red aura and the bright thermal core of a flame, eliminating false positives from posters or clothing.
- Persistence guard β fire must be visible for 1.5 seconds continuously before the alarm triggers.
- Auto-generated alarm β synthesises a fallback siren if
alarm.mp3is missing. - Clean HUD β minimal status overlay; no cluttered UI.
Python 3.8+ and:
pip install -r requirements.txtpython3 main.pyPress q to quit.
| Constant | Default | Purpose |
|---|---|---|
MIN_CONTOUR_AREA |
1500 |
Minimum fire blob size (pxΒ²). Increase to reduce false positives. |
MIN_CORE_RATIO |
0.07 |
Fraction of blob that must be bright core. |
PERSISTENCE_THRESHOLD |
1.5 |
Seconds before alarm triggers. |
HSV_AURA_LOWER/UPPER |
Orange/Red | Outer flame colour range. |
HSV_CORE_LOWER/UPPER |
Yellow/White | Inner hotspot colour range. |
MIT License β Β© 2026 Pratik Mishra. See LICENSE.