资源简介
基于Dlib的人脸识别样本采集,宿舍智能出入管理窗口系统,支持宿舍的增删,人脸的采集录入,日志管理,通过验证就播放语音“welcome!”(模拟开门)
代码片段和文件信息
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import wx
import wx.grid
import sqlite3
from time import localtimestrftime
import os
from skimage import io as iio
import io
import zlib
import dlib # 人脸识别的库dlib
import numpy as np # 数据处理的库numpy
import cv2 # 图像处理的库OpenCv
import _thread
import threading
import stat
import shutil
from playsound import playsound
import pyttsx3
ID_NEW_REGISTER = 160
ID_DELETE_MEMBER = 161
ID_START_PUNCHCARD = 190
ID_END_PUNCARD = 191
ID_NEW_MANAGER = 220
ID_OPEN_LOGCAT = 283
ID_CLOSE_LOGCAT = 284
ID_WORKER_UNAVIABLE = -1
PATH_FACE = “F:/WorkAttendanceSystem-master/V2.0/data/face_img_database/“
facerec = dlib.face_recognition_model_v1(“F:/WorkAttendanceSystem-master/V2.0/model/dlib_face_recognition_resnet_model_v1.dat“)
# Dlib 预测器
detector = dlib.get_frontal_face_detector()
predictor = dlib.shape_predictor(‘F:/WorkAttendanceSystem-master/V2.0/model/shape_predictor_68_face_landmarks.dat‘)
# In[2]:
def return_euclidean_distance(feature_1 feature_2):
feature_1 = np.array(feature_1)
feature_2 = np.array(feature_2)
dist = np.sqrt(np.sum(np.square(feature_1 - feature_2)))#欧式距离
if dist > 0.4:
return “diff“
else:
return “same“
class WAS(wx.frame):
def __init__(self):
wx.frame.__init__(selfparent=Nonetitle=“宿舍管理系统“size=(920560))
self.initMenu()
self.initInfoText()
self.initGallery()
self.initDatabase()
self.initData()
def initData(self):
self.name = ““
self.id =ID_WORKER_UNAVIABLE
self.face_feature = ““
self.pic_num = 0
self.flag_registed = False
self.loadDatabase(1)
def initMenu(self):
menuBar = wx.MenuBar() #生成菜单栏
menu_Font = wx.Font()#Font(faceName=“consolas“pointsize=20)
menu_Font.SetPointSize(14)
menu_Font.SetWeight(wx.BOLD)
registerMenu = wx.Menu() #生成菜单
self.new_register = wx.MenuItem(registerMenuID_NEW_REGISTER“新建录入“)
self.new_register.SetBitmap(wx.Bitmap(“F:/WorkAttendanceSystem-master/V2.0/drawable/new_register.png“))
self.new_register.SetTextColour(“SLATE BLUE“)
self.new_register.SetFont(menu_Font)
registerMenu.Append(self.new_register)
self.delete_member = wx.MenuItem(registerMenuID_DELETE_MEMBER“人员删除“)
self.delete_member.SetBitmap(wx.Bitmap(“F:/WorkAttendanceSystem-master/V2.0/drawable/finish_register.png“))
self.delete_member.SetTextColour(“SLATE BLUE“)
self.delete_member.SetFont(menu_Font)
registerMenu.Append(self.delete_member)
puncardMenu = wx.Menu()
self.start_punchcard = wx.MenuItem(puncardMenuID_START_PUNCHCARD“开始监测“)
self.start_punchcard.SetBitmap(wx.Bitmap(“F:/WorkAttendanceSystem-master/V2.0/drawable/start_punchcard.png“))
self.start_punchcard.SetTextColour(“SLATE BLUE“)
self.start_punchcard.SetFont(menu_Font)
puncardMenu.Append(self.start_punchcard)
s
相关资源
- 树莓派避障小车.py
- python编程相关的161本书内含解压密码
-
wxPython实现fr
ame界面的跳转 - 模式识别ISODATA算法
- Python - 截取指定帧数间隔指定大小的
- Graph Cut图像分割算法——Python+Opencv实
- 球面拟合-基于最小二乘法
- python+pyqt5显示图像,播放视频,绘图
- karmarkar.py
- python keylogger键盘记录源码
- Python基础训练100题(带答案).docx
- 燕大《Python机器学习》实验报告 .do
- 正向云模型发生器python
- 鱼C小甲鱼零基础入门学习Python视频课
- Python爬虫爬取51Job职位数据
- BP神经网络_Python实习_包含鸢尾花分类
- Python调用CAD生成多边形骨料
- python爬取豆瓣电影源码+报告.zip
- 利用python爬虫爬取王者荣耀数据.py
- Fiona-1.8.6-cp37-cp37m-win_amd64.whl
- FP_Growth算法python实现.rar.rar
- PyQt4-4.11.4 win32 python3.4直接安装版(
- 基于python+mysql的图书管理系统,有g
- 多目标优化算法(一)NSGA2python版
- 小甲鱼教程Python全部源码软件包课件
- 西电数据挖掘作业——关联规则apri
- Python 八数码问题,可以直接运行
- python学生管理系统
- GA-BP算法的python实现
- 朴素贝叶斯过滤垃圾邮件源码及数据
评论
共有 条评论