资源简介

基于opencv图像处理、人脸识别的疲劳驾驶检测系统

资源截图

代码片段和文件信息

import time
import threading
import face_recognition
import cv2
import numpy as np

driving_start = time.time()
previous_img = np.array([])


def is_similar(img1 img2):
    faces1 = face_recognition.face_encodings(img1)
    faces2 = face_recognition.face_encodings(img2)
    if len(faces1)==0 or len(faces2)==0: #如果没有检测到人脸,返回相似
        return True
    results = face_recognition.compare_faces([faces1[0]] faces2[0])
    return results[0]

def change_driver(new_img):
    global previous_img
    if previous_img.size == 0:
        previous_img = new_img
        return True
    elif is_similar(previous_img new_img):
        return False
    else:
        previous_img = new_img
        return True

def driving(img):
    global driving_start
    # print(“start:“ driving_start)
    if change_driver(img):
        driving_start = time.time()
        # print(“yigengxin“)
        # print(“start:“ driving_start)
    else:
        # print(“now:“time.time())
        # atime = 60
        atime = 14400     #4h
        if((time.time()-driving_start) > atime):
            # print(“驾驶时间超过60s“)
            return True



 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件         58  2019-05-30 13:03  Drowsiness_Detection\README.md

    .......   2813472  2019-05-12 14:34  Drowsiness_Detection\src\car.mp4

     文件       1160  2019-05-30 14:58  Drowsiness_Detection\src\driving_overtime.py

     文件       2075  2019-05-30 00:14  Drowsiness_Detection\src\Fatigue_Detection.py

     文件        202  2019-05-16 14:51  Drowsiness_Detection\src\main.py

     文件       1612  2019-05-12 21:06  Drowsiness_Detection\src\MainPage.py

     文件       9373  2019-05-30 00:20  Drowsiness_Detection\src\view.py

     文件        271  2019-05-29 23:58  Drowsiness_Detection\src\warning.py

     文件       1336  2019-05-13 19:57  Drowsiness_Detection\src\__pycache__\catchCap.cpython-37.pyc

    .......       707  2019-05-12 14:34  Drowsiness_Detection\src\__pycache__\Detector_PERCLOS.cpython-37.pyc

     文件        999  2020-03-22 18:59  Drowsiness_Detection\src\__pycache__\driving_overtime.cpython-37.pyc

     文件       1965  2019-05-30 00:14  Drowsiness_Detection\src\__pycache__\Fatigue_Detection.cpython-37.pyc

     文件       1559  2019-04-30 13:56  Drowsiness_Detection\src\__pycache__\LoginPage.cpython-37.pyc

     文件       1827  2019-05-12 21:08  Drowsiness_Detection\src\__pycache__\MainPage.cpython-37.pyc

     文件       8168  2019-05-30 00:20  Drowsiness_Detection\src\__pycache__\view.cpython-37.pyc

     文件        679  2019-05-29 23:58  Drowsiness_Detection\src\__pycache__\warning.cpython-37.pyc

    .......     16056  2019-05-12 14:34  Drowsiness_Detection\tools\1.mp3

    .......     18504  2019-05-12 14:34  Drowsiness_Detection\tools\2.mp3

    .......     19584  2019-05-12 14:34  Drowsiness_Detection\tools\3.mp3

     文件         53  2020-04-07 21:42  Drowsiness_Detection\tools\注:必看.txt

     目录          0  2020-03-22 18:59  Drowsiness_Detection\src\__pycache__

     目录          0  2019-07-18 21:21  Drowsiness_Detection\src

     目录          0  2020-04-07 21:42  Drowsiness_Detection\tools

     目录          0  2020-04-07 21:41  Drowsiness_Detection

----------- ---------  ---------- -----  ----

              2899660                    24


评论

共有 条评论