【OpenCV】使用Python和OpenCV实现火焰检测

1、 项目源码和结构(转) 

https://github.com/mushfiq1998/fire-detection-python-opencv

【OpenCV】使用Python和OpenCV实现火焰检测_第1张图片

2、 运行环境

# 安装playsound:用于播放报警声音

pip install playsound

# 安装opencv-python:cv2用于图像和视频处理,特别是用于检测火灾

pip install opencv-python

3、 fireDetection.py

import cv2         # Library for openCV
import threading   # Library for threading -- which allows code to run in backend
import playsound   # Library for alarm sound
import smtplib     # Library for email sending

# To access xml file which includes positive and negative images of fire. 
# (Trained images) File is also provided with the code.
fire_cascade = cv2.CascadeClassifier('fire_detection_cascade_model.xml')

# To start camera this com

你可能感兴趣的:(计算机视觉,opencv,python,人工智能,计算机视觉)