Fire-Detection-using-HAAR-Cascade-Classifier-in-OpenCV

This repo contains code that will detect fire in the room using live feed from a camera. The portion of the image with fire will be highlighted in red. We have used HAAR cascade classifier to classify the images as positives and negatives. Classifier has been trained using OpenCV on command line on a Windows 10 machine.

Setup

  1. OpenCV for Windows - 3.4.9
  2. OpenCV Python Library - 4.4.0
  3. Numpy - 1.18.1
  4. Serial Library in Python - 3.4

Training of Classifier

  1. Dataset for training was generated by capturing images from the webcam of the laptop and saving them using capture_images.py
  2. opencv_annotation.exe was used to mark out the regions containing fire in positive training images.
  3. positives.vec file was generated using opencv_createsamples using appropriate width and height parameters.
  4. Classifier was trained using opencv_traincascade and cascade.xml file was produced as an output.

Response to Fire Detection

  1. Arduino is connected to a USB port of computer.
  2. Python script communicates its output to Arduino through the USB port.
  3. Arduino starts pumping water to extinguish fire, buzzer and LEDs are turned on and the owner of the place is alerted via SMS.