├── CAiFaceDetection.py
├── CCamOpt.py
├── CFaceDetection.py
├── CFileOpt.py
├── CMaskDetection.py
├── CMaskOpt.py
├── CMySqlOpt.py
├── CNetWork.py
├── CSqliteOpt.py
├── Global.py
├── README.md
├── SystemSet.py
├── baiduAi.py
├── config
├── config.json
├── haarcascade_eye.xml
└── haarcascade_frontalface_default.xml
├── dataBase
├── error_face.db
└── error_face.sql
├── icon.ico
├── main.py
├── main.spec
├── ui_file
├── __pycache__
│ ├── resource_rc.cpython-37.pyc
│ ├── ui_login.cpython-37.pyc
│ ├── ui_main.cpython-37.pyc
│ ├── ui_reg.cpython-37.pyc
│ └── ui_start.cpython-37.pyc
├── main.pyproject
├── main.pyproject.user
├── resource
│ ├── icon
│ │ ├── check-circle.png
│ │ ├── decide.png
│ │ ├── icon.png
│ │ ├── login.png
│ │ ├── redo.png
│ │ ├── switchOff.png
│ │ ├── switchOffHover.png
│ │ ├── switchOffPressed.png
│ │ ├── switchOn.png
│ │ ├── title.png
│ │ ├── 人脸核身.png
│ │ ├── 人脸识别.png
│ │ ├── 图片.png
│ │ ├── 多云.png
│ │ ├── 导入.png
│ │ ├── 打勾_有圈.png
│ │ ├── 拉钩.png
│ │ ├── 提醒,感叹号_jurassic.png
│ │ ├── 时间.png
│ │ ├── 注册.png
│ │ ├── 爸爸.png
│ │ ├── 用户.png
│ │ └── 返回.png
│ ├── img
│ │ ├── Dark_人脸识别.png
│ │ ├── background.jpg
│ │ ├── background1.jpg
│ │ ├── background2.jpg
│ │ ├── background3.jpg
│ │ ├── background4.jpg
│ │ ├── background5.jpg
│ │ ├── board.png
│ │ ├── border.jpg
│ │ ├── color.jpg
│ │ ├── green.jpg
│ │ ├── main.jpg
│ │ └── reg.jpg
│ └── qss_file
│ │ ├── Aqua.qss
│ │ ├── QPushbtn.qss
│ │ └── start.qss
├── resource_rc.py
├── resource_rc.qrc
├── ui_login.py
├── ui_login.ui
├── ui_main.py
├── ui_main.ui
├── ui_reg.py
├── ui_reg.ui
├── ui_start.py
└── ui_start.ui
└── win
├── CLoginWin.py
├── CMainWin.py
├── CRegWin.py
├── CStartWin.py
├── CTableWidget.py
├── CWinManage.py
├── CWinOpt.py
└── CWinStart.py
/CAiFaceDetection.py:
--------------------------------------------------------------------------------
1 | import base64
2 | import cv2
3 | from baiduAi import *
4 |
5 |
6 | class CAiFaceDetection():
7 | def __init__(self):
8 | """
9 | 构造函数: 判断连接, 判断相应组的建立
10 | """
11 | self.face = CFaceId()
12 | try:
13 | self.CreatGroup()
14 | except:
15 | print("网络连接出错")
16 |
17 | def UserQuire(self, user_id, group_id):
18 | """
19 | 用户信息查询
20 | :param user_id: 用户ID
21 | :param group_id: 组ID
22 | :return: 查询的结果
23 | """
24 | result = self.face.getUser(user_id, group_id)
25 | if result['error_msg'] == 'SUCCESS':
26 | return '0' # 查有相同的用户名
27 | elif result['error_msg'] == 'user not exist':
28 | return '1' # 查无相同的用户名
29 | else:
30 | return "Connect Error!"
31 |
32 | def CreatGroup(self):
33 | """
34 | 创建用户组: temp(学员用户组)/ safeguard(安保用户组)
35 | :return:
36 | """
37 | self.face.GroupAdd("SafeGuard")
38 | self.face.GroupAdd("temp")
39 |
40 | def FaceAdd(self, name, image, group="temp"):
41 | """
42 | 人脸添加
43 | :param name: 人脸的名称
44 | :param image: 图片的名称
45 | :param group: 组的名称
46 | :return: 添加的结果
47 | """
48 | img_encode = cv2.imencode('.jpg', image)[1]
49 | image_code = str(base64.b64encode(img_encode))[2:-1]
50 | result = self.face.FaceAdd(image_code, name, group)
51 | if result['error_msg'] == 'SUCCESS':
52 | return result['result']["face_token"]
53 | return False
54 |
55 | def GetFaceToken(self, user_id):
56 | """
57 | 获取脸照片的唯一标识符
58 | :param user_id: 用户ID
59 | :return: 唯一标识符集合
60 | """
61 | result = self.face.aipFace.faceGetlist(user_id, self.face.group)
62 | if result['error_code'] == 0:
63 | return result['result']['face_list'][0]['face_token']
64 | else:
65 | return False
66 |
67 | def FaceUpdate(self, name, image):
68 | """
69 | 脸部更新
70 | :param name: 用户脸部名称
71 | :param image: 用户图像
72 | :return: 脸部更新的结果
73 | """
74 | img_encode = cv2.imencode('.jpg', image)[1]
75 | image_code = str(base64.b64encode(img_encode))[2:-1]
76 | result = self.face.FaceUpdate(image_code, name, self.face.group)
77 | if result['error_msg'] == 'SUCCESS':
78 | return result['result']["face_token"]
79 | return False
80 |
81 | def FaceDelete(self, user_id, face_token):
82 | """
83 | 脸部删除
84 | :param user_id: 用户ID
85 | :param face_token: 人脸标识符
86 | :return: 删除的结果
87 | """
88 | result = self.face.aipFace.faceDelete(user_id, self.face.group, face_token)
89 | if result['error_code'] == 0:
90 | return True
91 | else:
92 | return False
93 |
94 | def FaceResearch(self, image, group_name="temp"):
95 | """
96 | 人脸搜索匹配
97 | :param image: 脸部的图像 Base64编码
98 | :param group_name: 组名
99 | :return:
100 | """
101 | local = []
102 | img_encode = cv2.imencode('.jpg', image)[1]
103 | image_code = str(base64.b64encode(img_encode))[2:-1]
104 | result = self.face.FaceMultiSearch(image_code, "BASE64", group_name)
105 | if result['error_msg'] == 'SUCCESS':
106 | for ret in result['result']['face_list']:
107 | if len(ret['user_list']) != 0:
108 | local.append((ret['location'], 'green'))
109 | else:
110 | local.append((ret['location'], 'red'))
111 | return local
112 |
113 | def FaceLogin(self, image, group_name="temp"):
114 | """
115 | 人脸登陆
116 | :param image: 脸部的图片
117 | :param group_name: 组名
118 | :return: 登陆的结果
119 | """
120 | local = []
121 | img_encode = cv2.imencode('.jpg', image)[1]
122 | image_code = str(base64.b64encode(img_encode))[2:-1]
123 | result = self.face.FaceMultiSearch(image_code, "BASE64", group_name)
124 | if result['error_msg'] == 'SUCCESS':
125 | local = result['result']['face_list'][0]['user_list'][0]['user_id']
126 | return local
127 |
128 | def FaceCheck(self, frame_img, group_name="temp"):
129 | """
130 | 脸部查验
131 | :param frame_img: 帧图片
132 | :param group_name: 组名
133 | :return: 人脸识别的结果
134 | """
135 | local = self.FaceResearch(frame_img, group_name)
136 | # 对每张人脸进行识别
137 | for x in range(len(local)):
138 | width = int(local[x][0]['width'])
139 | height = int(local[x][0]['height'])
140 | left = int(local[x][0]['left'])
141 | top = int(local[x][0]['top'])
142 | if local[x][1] == 'green':
143 | cv2.rectangle(frame_img, (left, top - width), (left + height, top + width), (0, 255, 0), 2)
144 | else:
145 | cv2.rectangle(frame_img, (left, top - width), (left + height, top + width), (0, 0, 255), 2)
146 | return frame_img
147 |
148 | def AiBodyTracking(self, image, is_init):
149 | """
150 | AI身体追踪
151 | :param image: 人脸图片 Base64
152 | :param is_init: 初始化
153 | :return: 识别的结果
154 | """
155 | area = str(image.shape[0]) + ',' + str(image.shape[1])
156 | img_encode = cv2.imencode('.jpg', image)[1]
157 | image_code = base64.b64encode(img_encode)[2:-1]
158 | result = self.face.BodyTracking(image_code, is_init, area)
159 | print(result)
160 |
161 | # 1:M对比
162 | def FaceCompare(self, image, group_id):
163 | """
164 | 人脸对比的结果
165 | :param image: 人脸图片 Base64
166 | :param group_id: 组ID
167 | :return: 人脸对比的结果
168 | """
169 | img_encode = cv2.imencode('.jpg', image)[1]
170 | image_code = str(base64.b64encode(img_encode))[2:-1]
171 | result = self.face.FaceSearch(image_code, group_id=group_id)
172 | if result['error_msg'] == 'SUCCESS' and result['result']['user_list']["score"] > 80:
173 | return result['result']['user_id'], result['result']['user_info']
174 | return None, None
175 |
176 | # 用户信息查询
177 | def UserIdQuire(self, user_id, group_id='temp'):
178 | """
179 | 用户信息查询, 判断是否存在该用户ID
180 | :param user_id: 用户ID
181 | :param group_id: 组ID
182 | :return: 查询的结果
183 | """
184 | result = self.face.UserQuire(user_id, group_id=group_id)
185 | return result
186 |
--------------------------------------------------------------------------------
/CCamOpt.py:
--------------------------------------------------------------------------------
1 | import datetime
2 | import threading
3 | import time
4 | from PyQt5.QtGui import QImage, QPixmap
5 | import cv2
6 | from PyQt5.QtWidgets import QMessageBox
7 | from PyQt5.uic.properties import QtWidgets
8 |
9 |
10 | class CCamOpt():
11 | def __init__(self, save_dir, device_num, win_opt, face_check, mask_check):
12 | """
13 | 相机类,初始化
14 | :param save_dir: 照片的存储位置
15 | :param device_num: 设备编号
16 | :param win_opt: 窗口类函数
17 | :param face_check: AI人脸检测类函数
18 | :param mask_check: 口罩识别类函数
19 | """
20 | self.save_dir = save_dir
21 | # 相关状态
22 | self.is_save = False
23 | self.is_start = False
24 | self.is_exit = False
25 | self.is_stop = False
26 | # 相关参数
27 | self.name = "temp"
28 | self.CAM_NUM = device_num
29 | self.save_res = False
30 | self.class_mode = False
31 | # 照片存储结构
32 | self.face_pic = []
33 | self.face_local = []
34 | # 相关类初始化
35 | self.c_win_opt = win_opt # CWinOpt()
36 | self.face_check = face_check # CAiFaceDetection()
37 | self.mask_check = mask_check # CMaskDetection()
38 | # 口罩佩戴计数器
39 | self.mask_num = 0
40 | self.no_mask_num = 0
41 | pass
42 |
43 | def __del__(self):
44 | """
45 | 析构函数, 调用退出相机函数
46 | :return: 无
47 | """
48 | self.ExitCam()
49 |
50 | def ThreadOptShowVideo(self, file_name, label, ai_switch=True, class_mode=False):
51 | """
52 | 线程选项--将摄像机or视频显示到控件上面
53 | :param file_name: 文件名
54 | :param label: 标签
55 | :param ai_switch: 是否启动AI识别
56 | :param class_mode: 是否启动口罩事变
57 | :return: 无
58 | """
59 | # 创建线程
60 | if file_name != "":
61 | # 如果摄像头已经启动
62 | if self.is_start:
63 | if self.c_win_opt.TwoBtnMsgBox('警告', "请注意, 打开视频文件将会覆盖摄像头!", QMessageBox.Warning):
64 | self.is_save = True
65 | else:
66 | return
67 | # 如果摄像头未启动
68 | "打开视频文件"
69 | cap = cv2.VideoCapture(file_name)
70 | frame_all = cap.get(cv2.CAP_PROP_FRAME_COUNT)
71 | if frame_all <= 5:
72 | self.c_win_opt.OneBtnMsgBox('警告', "您打开的不是视频文件,或视频文件时常过短!", QMessageBox.Warning)
73 | return
74 | else:
75 | if self.is_start:
76 | # 如果摄像头已经启动
77 | if self.c_win_opt.TwoBtnMsgBox('警告', "摄像头已经启动了, 是否重新启动?", QMessageBox.Warning):
78 | self.SavePic()
79 | time.sleep(1)
80 | else:
81 | return
82 | cap = cv2.VideoCapture() # 视频流
83 | flag = cap.open(self.CAM_NUM) # 参数是0,表示打开笔记本的内置摄像头,参数是视频文件路径则打开视频
84 | if not flag: # flag表示open()成不成功
85 | self.c_win_opt.OneBtnMsgBox('警告', "请检查相机于电脑是否连接正确!", QMessageBox.Warning)
86 | return
87 | else:
88 | cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc('M', 'J', 'P', 'G'))
89 | # 标识符搁置
90 | self.is_exit = False
91 | # 判断是教室模式还是闸机模式
92 | self.ClassModeSet(class_mode)
93 | self.lock = threading.Lock()
94 | thread = threading.Thread(target=self.ShowVideo, args=(cap, label, ai_switch,))
95 | # 启动线程
96 | thread.start()
97 |
98 | def ClassModeSet(self, state):
99 | """
100 | 分类模式设置
101 | :param state: False不启动口罩, True启动口罩
102 | :return:
103 | """
104 | self.class_mode = state
105 |
106 | def ReadSaveRes(self):
107 | """
108 | 读取存储的结果
109 | :return: 无
110 | """
111 | return self.save_res
112 |
113 | def Stop(self):
114 | """
115 | 暂停相机函数
116 | :return: 无
117 | """
118 | self.is_stop = True
119 |
120 | def Start(self):
121 | """
122 | 启动相机函数
123 | :return: 无
124 | """
125 | self.is_stop = False
126 |
127 | def SavePic(self):
128 | """
129 | 保存图片
130 | :return: 无
131 | """
132 | self.is_save = True
133 |
134 | def ExitCam(self):
135 | """
136 | 退出相机
137 | :return: 无
138 | """
139 | self.is_save = True
140 | self.is_exit = True
141 |
142 | def GetFacePicInfo(self):
143 | """
144 | 获取人脸相机的信息
145 | :return: 无
146 | """
147 | return self.face_pic, self.face_local
148 |
149 | def LabelSetPic(self, label, frame, width, height, draw_judge=False, save_staus=False):
150 | """
151 | 标签设置, 将帧印到标签上
152 | :param label: QT标签控件
153 | :param frame: 视频帧
154 | :param width: 宽度
155 | :param height: 高度
156 | :param draw_judge: 是否需要调用AI, 绘制人脸框
157 | :param save_staus: 保存的状态
158 | :return: 返回的结果
159 | """
160 | frame = cv2.flip(frame, 1) # 水平反转
161 | show = cv2.resize(frame, (width, height)) # 重设尺寸
162 | # 判断是否需要调用AI
163 | if draw_judge:
164 | self.face_check.FaceCheck(show)
165 | # 判断是否是教室检查模式
166 | elif self.class_mode:
167 | # 实时检查
168 | self.face_pic, self.face_local = self.mask_check.MaskDetect(show)
169 | if save_staus:
170 | for x in self.face_local:
171 | if x[4] == 1:
172 | self.mask_num += 1
173 | elif x[4] == 0:
174 | self.no_mask_num += 0
175 | else:
176 | continue
177 | # 时间追踪
178 | self.BodyTracking()
179 | show = cv2.cvtColor(show, cv2.COLOR_BGR2RGB) # 格式转换
180 | show_image = QImage(show.data, show.shape[1], show.shape[0], QImage.Format_RGB888)
181 | try:
182 | label.setPixmap(QPixmap.fromImage(show_image))
183 | except:
184 | print("Labels设置出现错误:", label)
185 | return True
186 | # 如果点击保存则将该帧保存到目录里面
187 | if self.is_save or self.is_exit:
188 | print("结束视频帧的操作:", self.save_dir, self.name)
189 | self.save_res = True
190 | self.is_save = False
191 | self.is_start = False
192 | return True
193 | # 如果暂停, 则进入死循环
194 | while True:
195 | if not self.is_stop:
196 | break
197 |
198 | def BodyTracking(self):
199 | """
200 | 时间范围内判断
201 | :return: 无
202 | """
203 | # 范围时间
204 | time1 = '08:00'
205 | time2 = '12:00'
206 | time3 = '13:00'
207 | time4 = '18:00'
208 | time5 = '19:00'
209 | time6 = '22:00'
210 | # 获取当前时间
211 | now_time = datetime.datetime.now()
212 | hour = now_time.strftime('%H:%M')
213 | time = now_time.strftime('%Y-%m-%d %H:%M:%S')
214 | # 时间区间判断
215 | if hour == time1:
216 | self.mask_num = 0
217 | self.no_mask_num = 0
218 | elif hour == time2:
219 | # 保存到数据库
220 | self.DataSave(time, 1)
221 | elif hour == time3:
222 | self.mask_num = 0
223 | self.no_mask_num = 0
224 | elif hour == time4:
225 | # 保存到数据库
226 | self.DataSave(time, 2)
227 | elif hour == time5:
228 | self.mask_num = 0
229 | self.no_mask_num = 0
230 | elif hour == time6:
231 | # 保存到数据库
232 | self.DataSave(time, 3)
233 |
234 | # 保存到数据库内
235 | def DataSave(self, time, status):
236 | """
237 | 数据保存
238 | :param time: 保存的时间点
239 | :param status: 保存的状态(1 8点, 2 16点, 3 22点)
240 | :return: 无
241 | """
242 | # 插入数据数据库
243 | z = [self.mask_num, self.no_mask_num, time, status]
244 | self.__c_sqlite_opt.execute("INSERT INTO maskinfo (take_mask, no_mask, time, status) values (?,?, ?);", z)
245 | self.mask_num = 0
246 | self.no_mask_num = 0
247 |
248 | def ShowVideo(self, cap, label, ai_switch=True):
249 | """
250 | 显示视频
251 | :param cap: 打开视频的控件
252 | :param label: 标签控件
253 | :param ai_switch: 是否启动AI标识符
254 | :return:
255 | """
256 | self.is_start = True
257 | self.is_save = False
258 | width = 400
259 | height = 300
260 | self.lock.acquire()
261 | flag = 0
262 | while not self.is_exit:
263 | flag, frame = cap.read()
264 | if flag == 5:
265 | if self.LabelSetPic(label, frame, width, height, ai_switch, True):
266 | break
267 | else:
268 | if self.LabelSetPic(label, frame, width, height, ai_switch, False):
269 | break
270 | self.lock.release()
271 | # 计数器清零
272 | self.mask_num = 0
273 | self.no_mask_num = 0
274 | cap.release()
275 | if ai_switch:
276 | label.clear()
277 |
--------------------------------------------------------------------------------
/CFaceDetection.py:
--------------------------------------------------------------------------------
1 | import cv2
2 | import numpy as np
3 |
4 |
5 | class CFaceDetection():
6 | def __init__(self):
7 | """
8 | OpenCv2 人脸检测级联分类器, 用以识别图像内是否有人脸
9 | """
10 | self.face_cascade = cv2.CascadeClassifier(r'config/haarcascade_frontalface_default.xml')
11 | self.eye_cascade = cv2.CascadeClassifier(r'config/haarcascade_eye.xml')
12 |
13 | @staticmethod
14 | def QpixmapToCvImg(qtpixmap):
15 | """
16 | 将Pixmap转成Cv图像
17 | :param qtpixmap: pixmap图像
18 | :return: 转成cv图像的结果
19 | """
20 | qimg = qtpixmap.toImage()
21 | temp_shape = (qimg.height(), qimg.bytesPerLine() * 8 // qimg.depth())
22 | temp_shape += (4,)
23 | ptr = qimg.bits()
24 | ptr.setsize(qimg.byteCount())
25 | result = np.array(ptr, dtype=np.uint8).reshape(temp_shape)
26 | result = result[..., :3]
27 | return result
28 |
29 | # 人脸识别
30 | def FaceDetection(self, img):
31 | """
32 | 人脸检测
33 | :param img: 人脸图片
34 | :return: 人脸检测的结果
35 | """
36 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
37 | rects = self.Detect(gray)
38 | res = []
39 | if len(rects) > 0: # 大于零检测人脸
40 | for x1, y1, x2, y2 in rects:
41 | crop = img[y1:y2, x1:x2]
42 | res.append(crop)
43 | return res
44 |
45 | def FaceDetectionPicAndLocal(self, img, face_pic, face_local):
46 | """
47 | 在人脸检测的基础上, 加上了坐标定位
48 | :param img: 图片
49 | :param face_pic: 需要保存人脸的 list
50 | :param face_local: 需要保存人脸位置的 list
51 | :return: 无
52 | """
53 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
54 | rects = self.Detect(gray)
55 | if len(rects) > 0: # 大于零检测人脸
56 | for x1, y1, x2, y2 in rects:
57 | crop = img[y1:y2, x1:x2]
58 | face_pic.append(crop)
59 | face_local.append((x1, y1, x2, y2))
60 |
61 | def Detect(self, img):
62 | """
63 | 人脸检测
64 | :param img: 图片
65 | :return: 检测的结果
66 | """
67 | rects = self.face_cascade.detectMultiScale(img, scaleFactor=1.3, minNeighbors=4, minSize=(30, 30))
68 | if len(rects) == 0:
69 | return []
70 | rects[:, 2:] += rects[:, :2]
71 | return rects
72 |
--------------------------------------------------------------------------------
/CFileOpt.py:
--------------------------------------------------------------------------------
1 | class CFileOpt():
2 | @staticmethod
3 | def readQss(path):
4 | """
5 | 读取QSS文件
6 | :param path: QSS文件的路径
7 | :return:
8 | """
9 | with open(path) as f:
10 | qss = f.read()
11 | f.close()
12 | return qss
13 |
--------------------------------------------------------------------------------
/CMaskDetection.py:
--------------------------------------------------------------------------------
1 | from CMaskOpt import *
2 | from CFaceDetection import *
3 |
4 |
5 | class CMaskDetection():
6 | def __init__(self):
7 | """
8 | 口罩识别检测
9 | """
10 | self.mask_opt = CMaskOpt()
11 | self.face_detection = CFaceDetection()
12 |
13 | def MaskDetect(self, img):
14 | """
15 | 口罩检测
16 | :param img: 图片
17 | :return: 识别口罩的人脸图片, 坐标位置
18 | """
19 | # 读取口罩上的人脸
20 | face_pic = []
21 | face_local = []
22 | self.face_detection.FaceDetectionPicAndLocal(img, face_pic, face_local)
23 | # 每张人脸输入进去识别, 并绘图
24 | for x in range(len(face_pic)):
25 | res = self.mask_opt.UsingModel(face_pic[x])
26 | x1, y1, x2, y2 = face_local[x]
27 | if res == 1:
28 | # 没带口罩
29 | cv2.rectangle(img, (x1, y1), (x2, y2), (0, 0, 255), 2)
30 | face_local[x] = (x1, y1, x2, y2, 1)
31 | elif res == 0:
32 | # 带口罩
33 | cv2.rectangle(img, (x1, y1), (x2, y2), (0, 255, 0), 2)
34 | face_local[x] = (x1, y1, x2, y2, 0)
35 | else:
36 | print("模型加载出现错误!")
37 | # 返回识别的结果
38 | return face_pic, face_local
39 |
--------------------------------------------------------------------------------
/CMaskOpt.py:
--------------------------------------------------------------------------------
1 | import cv2
2 | import numpy as np
3 | import tflearn
4 | from Global import CONFIG
5 | from tflearn.layers.conv import conv_2d, max_pool_2d
6 | from tflearn.layers.core import input_data, fully_connected, dropout
7 | from tflearn.layers.estimator import regression
8 | from tflearn.layers.normalization import local_response_normalization
9 |
10 |
11 | class CMaskOpt():
12 | def __init__(self):
13 | """
14 | 构造函数, 进行模型的训练
15 | """
16 | self.IMAGE_SIZE = CONFIG["@mask_detection"]["IMAGE_SIZE"]
17 | self.MODEL_NAME = CONFIG["@mask_detection"]["model_name"]
18 | self.LEARNING_RATE = CONFIG["@mask_detection"]["LEARNING_RATE"]
19 | self.network = []
20 | self.model = []
21 | # 读取与获取模型
22 | self.modelStructure()
23 | self.ReadModel()
24 |
25 | def modelStructure(self):
26 | """
27 | 模型的结构
28 | :return:
29 | """
30 | # 输入层 placeholder
31 | conv_input = input_data(shape=[None, self.IMAGE_SIZE, self.IMAGE_SIZE, 3], name="input")
32 |
33 | """ 第一层 卷积池化层"""
34 | # incoming, nb_filter输出高度, filter_size 卷积核大小
35 | self.network = conv_2d(conv_input, 96, 11, strides=4, activation="relu") # 卷积
36 | self.network = max_pool_2d(self.network, 3, strides=2) # 池化
37 | self.network = local_response_normalization(self.network)
38 |
39 | """ 第二层 卷积池化层"""
40 | self.network = conv_2d(self.network, 256, 5, activation="relu") # 卷积
41 | self.network = max_pool_2d(self.network, 3, strides=2) # 池化
42 | self.network = local_response_normalization(self.network)
43 |
44 | """ 第三层 三重卷积层"""
45 | self.network = conv_2d(self.network, 384, 3, activation='relu')
46 | self.network = conv_2d(self.network, 384, 3, activation='relu')
47 | self.network = conv_2d(self.network, 256, 3, activation='relu')
48 | self.network = max_pool_2d(self.network, 3, strides=2)
49 | self.network = local_response_normalization(self.network)
50 |
51 | """ 第四层 双重全连接层 """
52 | # incoming, n_units, activation='linear'
53 | self.network = fully_connected(self.network, 4096, activation='tanh')
54 | self.network = dropout(self.network, 0.5)
55 | self.network = fully_connected(self.network, 4096, activation='tanh')
56 | self.network = dropout(self.network, 0.5)
57 |
58 | """ 第五层 输出层 """
59 | self.network = fully_connected(self.network, 2, activation="softmax") # 全连接层
60 |
61 | # 构建损失函数核优化器
62 | self.network = regression(self.network, placeholder='default', optimizer='momentum', # 优化器
63 | loss='categorical_crossentropy',
64 | learning_rate=self.LEARNING_RATE)
65 |
66 | def ReadModel(self):
67 | """
68 | 读取Model
69 | :return:无
70 | """
71 | self.model = tflearn.DNN(self.network, checkpoint_path='model_alexnet',
72 | max_checkpoints=1, tensorboard_verbose=2)
73 | self.model.load(self.MODEL_NAME, weights_only=True)
74 |
75 | def UsingModel(self, img):
76 | """
77 | 使用模型, 输入图片, 判断有没有戴口罩
78 | :param img: 参数图片
79 | :return:
80 | """
81 | img_resize = cv2.resize(img, (self.IMAGE_SIZE, self.IMAGE_SIZE))
82 | img_resize = img_resize.reshape((-1, self.IMAGE_SIZE, self.IMAGE_SIZE, 3))
83 | num = self.model.predict(img_resize) # 获取概率
84 | classify = np.argmax(num) # 获取标签
85 | if classify == 0:
86 | return 0
87 | elif classify == 1:
88 | return 1
89 | else:
90 | print("Error: Masks cannot be identified")
91 | return -1
92 |
93 | @staticmethod
94 | def getScore(y_test, predict_test):
95 | """
96 | 获取口罩识别结果的分值
97 | :param y_test: 测试结果
98 | :param predict_test: 预测结果
99 | :return: 无
100 | """
101 | correct = 0
102 | error = 0
103 | for i in range(len(y_test)):
104 | print(y_test[i])
105 | if (y_test[i] == predict_test[i]).all():
106 | correct += 1
107 | else:
108 | error += 1
109 | res = correct / len(y_test)
110 | print('Test accuracy:%.2f%%' % res)
111 |
--------------------------------------------------------------------------------
/CMySqlOpt.py:
--------------------------------------------------------------------------------
1 | # *coding:utf-8 *
2 | from Global import CONFIG
3 | import pymysql
4 |
5 |
6 | class CDbOpt:
7 | def __init__(self):
8 | """
9 | MySql操纵类函数的相关初始化数值
10 | """
11 | self.conn_mysql = pymysql.Connect(
12 | database=CONFIG["@mysql_opt"]["mysql_db"],
13 | user=CONFIG["@mysql_opt"]["mysql_user"],
14 | password=CONFIG["@mysql_opt"]["mysql_pwd"],
15 | host=CONFIG["@mysql_opt"]["mysql_host"],
16 | port=CONFIG["@mysql_opt"]["mysql_port"],
17 | charset=CONFIG["@mysql_opt"]["mysql_charset"],
18 | )
19 |
20 | def __del__(self):
21 | """
22 | 析构函数: 关闭Sql连接
23 | """
24 | self.conn_mysql.close()
25 |
26 | def Db_Selete(self, *args, **kwargs):
27 | # 获取数据字段
28 | # 整理出sql
29 | # 调用db
30 | table = args[0]
31 | where_fields = ''
32 | data = kwargs.get('data')
33 | where_list = data.get('where_list')
34 | select_list = data.get('select_list')
35 | if where_list != None:
36 | del data['where_list']
37 | if select_list != None:
38 | del data['select_list']
39 | for k, v in data.items():
40 | if k in where_list:
41 | if where_fields == '':
42 | where_fields += f"{k}='{v}'"
43 | else:
44 | where_fields += f"and {k}='{v}'"
45 | fields = ','.join(select_list)
46 |
47 | cursor = self.conn_mysql.cursor()
48 | sql = f"""select {fields} from {table} where {where_fields}"""
49 | cursor.execute(sql)
50 | result = cursor.fetchall()
51 | return result
52 |
53 | def Db_SELECT_SQL(self, sql):
54 | # 获取数据字段
55 | # 整理出sql
56 | # 调用db
57 | cursor = self.conn_mysql.cursor()
58 | cursor.execute(sql)
59 | result = cursor.fetchall()
60 | return result
61 |
62 | def Db_Update_SQL(self, sql):
63 | # 调用sql
64 | cursor = self.conn_mysql.cursor()
65 | try:
66 | cursor.execute(sql)
67 | self.conn_mysql.commit()
68 | return True
69 | except Exception as e:
70 | print(e)
71 | self.conn_mysql.rollback()
72 | return False
73 |
74 | def Db_Update(self, *args, **kwargs):
75 | table = args[0]
76 | fields = ''
77 | where_fields = ''
78 | data = kwargs.get('data')
79 | where_list = data.get('where_list')
80 | select_list = data.get('select_list')
81 | if where_list != None:
82 | del data['where_list']
83 | if select_list != None:
84 | del data['select_list']
85 | for k, v in data.items():
86 | if k in where_list:
87 | if where_fields == '':
88 | where_fields += f"{k}='{v}'"
89 | else:
90 | where_fields += f"and {k}='{v}'"
91 | else:
92 | if fields == '':
93 | fields += f"{k}='{v}'"
94 | else:
95 | fields += f", {k}='{v}'"
96 |
97 | # 调用sql
98 | cursor = self.conn_mysql.cursor()
99 | sql = f"""update {table} set {fields} where {where_fields}"""
100 | try:
101 | cursor.execute(sql)
102 | self.conn_mysql.commit()
103 | except Exception as e:
104 | print(e)
105 | self.conn_mysql.rollback()
106 |
107 |
108 | def Db_Insert(self, *args, **kwargs):
109 | table = args[0]
110 | fields = ''
111 | where_fields = ''
112 | data = kwargs.get('data')
113 | where_list = data.get('where_list')
114 | select_list = data.get('select_list')
115 | if where_list != None:
116 | del data['where_list']
117 | if select_list != None:
118 | del data['select_list']
119 | num = 0
120 | for k, v in data.items():
121 | if num == 0:
122 | where_fields += f"{k}"
123 | fields += f"'{v}'"
124 | else:
125 | where_fields += f", {k}"
126 | fields += f", '{v}'"
127 | num += 1
128 |
129 | cursor = self.conn_mysql.cursor()
130 | sql = f"""insert into {table} ({where_fields}) values({fields})"""
131 | try:
132 | cursor.execute(sql)
133 | self.conn_mysql.commit()
134 | return True
135 | except Exception as e:
136 | print(e)
137 | self.conn_mysql.rollback()
138 | return False
139 |
140 | def Db_Delete(self, *args, **kwargs):
141 | table = args[0]
142 | fields = ''
143 | where_fields = ''
144 | data = kwargs.get('data')
145 | where_list = data.get('where_list')
146 | select_list = data.get('select_list')
147 | if where_list != None:
148 | del data['where_list']
149 | if select_list != None:
150 | del data['select_list']
151 | for k, v in data.items():
152 | if fields == '':
153 | fields += f"{k}='{v}'"
154 | else:
155 | fields += f", {k}='{v}'"
156 | if k in where_list:
157 | if where_fields == '':
158 | where_fields += f"{k}='{v}'"
159 | else:
160 | where_fields += f"and {k}='{v}'"
161 |
162 | cursor = self.conn_mysql.cursor()
163 | sql = f"""delete from {table} where {where_fields}"""
164 | try:
165 | cursor.execute(sql)
166 | self.conn_mysql.commit()
167 | except Exception as e:
168 | print(e)
169 | self.conn_mysql.rollback()
170 |
--------------------------------------------------------------------------------
/CNetWork.py:
--------------------------------------------------------------------------------
1 | # encoding:utf-8
2 | from Global import CONFIG
3 | import requests
4 |
5 |
6 | class CNetWork():
7 | def __init__(self):
8 | """
9 | 判断百度AI服务器的连接状态, 同时也可以获取Token
10 | """
11 | "输入KEY的值"
12 | self.API_KEY = CONFIG["@baidu_api"]["API_KEY"]
13 | "输入SECRET_KEY的值"
14 | self.SECRET_KEY = CONFIG["@baidu_api"]["SECRET_KEY"]
15 |
16 | def ConnectCheck(self):
17 | """
18 | 获取连接状态
19 | :return: 0: 正常连接, -2:APIkey不正确, -3:SecretKey不正确, -4 异常错误
20 | """
21 | # client_id 为官网获取的AK, client_secret 为官网获取的SK
22 | host = 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id='
23 | host += self.API_KEY + '&client_secret=' + self.SECRET_KEY
24 | try:
25 | response = requests.get(host)
26 | if response.status_code == 200:
27 | # 连接成功, 检查token
28 | re_json = response.json()
29 | if 'error' in re_json:
30 | if re_json['error_description'] == 'unknown client id':
31 | # API Key不正确
32 | return -2
33 | else:
34 | # Secret Key不正确
35 | return -3
36 | return 0
37 | else:
38 | return -1
39 | except:
40 | # 网络连接问题
41 | return -4
42 |
--------------------------------------------------------------------------------
/CSqliteOpt.py:
--------------------------------------------------------------------------------
1 | import sqlite3
2 | from Global import CONFIG
3 |
4 |
5 | class CSqliteOpt():
6 | """
7 | Sqlite3 简单操作函数
8 | """
9 |
10 | def __init__(self):
11 | """
12 | 初始化数据库,默认文件名 stsql.db
13 | filename:文件名
14 | """
15 | self.filename = CONFIG["@Sqlite3"]["db_file"]
16 | self.db = sqlite3.connect(self.filename)
17 | self.c = self.db.cursor()
18 |
19 | def __del__(self):
20 | self.close()
21 |
22 | def close(self):
23 | """
24 | 关闭数据库
25 | """
26 | self.c.close()
27 | self.db.close()
28 |
29 | def execute(self, sql, param=None):
30 | """
31 | 执行数据库的增、删、改
32 | sql:sql语句
33 | param:数据,可以是list或tuple,亦可是None
34 | retutn:成功返回True
35 | """
36 | try:
37 | if param is None:
38 | self.c.execute(sql)
39 | else:
40 | if type(param) is list:
41 | self.c.executemany(sql, param)
42 | else:
43 | self.c.execute(sql, param)
44 | count = self.db.total_changes
45 | self.db.commit()
46 | except Exception as e:
47 | print(e)
48 | return False
49 | if count > 0:
50 | return True
51 | else:
52 | return False
53 |
54 | def query(self, sql, param=None):
55 | """
56 | 查询语句
57 | sql:sql语句
58 | param:参数,可为None
59 | retutn:成功返回True
60 | """
61 | if param is None:
62 | self.c.execute(sql)
63 | else:
64 | self.c.execute(sql, param)
65 | return self.c.fetchall()
66 |
--------------------------------------------------------------------------------
/Global.py:
--------------------------------------------------------------------------------
1 | from CFaceDetection import CFaceDetection
2 | from CFileOpt import CFileOpt
3 | import json
4 |
5 | print("Global运行次数....")
6 |
7 |
8 | # 照片参数
9 | IMAGE_SIZE = 150 # 表示图片的大小
10 |
11 | # 背景图片
12 | BACKGROUND_PATH = "./ui_file/resource/img/background5.jpg"
13 |
14 | # 样式设计
15 | QSS = CFileOpt().readQss("ui_file/resource/qss_file/QPushbtn.qss")
16 | CORRECT_PIC = "ui_file/resource/icon/打勾_有圈.png"
17 | ERROR_PIC = "ui_file/resource/icon/提醒,感叹号_jurassic.png"
18 |
19 | # 读取配置文件
20 | File = open("./config/config.json", "r")
21 | print("读取Json文件")
22 | CONFIG = json.loads(File.read())
23 | File.close()
24 |
25 | # 基本参数设置
26 | LOGIN = 101
27 | REGISTER = 102
28 | KEEP_ALIVE = 110
29 |
30 | # 获取FaceDetection
31 | face_detection = CFaceDetection()
32 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 智能校园防御软件
2 |
3 | ### 版权说明
4 | 本项目为个人练手项目,项目内的图片素材均来源网上,代码均为本人手写,仅供参考,请勿用于商业用途。本项目模型训练素材采用 网络爬虫获取,可能涉及版权问题,不予公开,请自行训练。
5 |
6 | ### 环境选型
7 | 1. 语言:Python
8 | 2. 操作系统:Windows
9 | 3. 数据库:MySQL
10 | 4. 窗口界面:PyQT
11 | 5. API接口:百度AI接口,用以实现人脸登陆与注册
12 |
13 | ### 远程MySQL表结构
14 | **本源码的远端MYSQL服务器过期了,上面的mysql数据库也凉凉了,在这里更新远程mysql表结构,有兴趣的可以自己搭建一下**
15 | 
16 |
17 | ### 远程表结构sql脚本(未测试)
18 | ```
19 | DROP TABLE IF EXISTS `access_record_table`;
20 | CREATE TABLE `access_record_table` (
21 | record_id int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
22 | has_mask enum('0','1') NOT NULL DEFAULT '0' COMMENT '是否佩戴口罩',
23 | access_time timestamp DEFAULT CURRENT_TIMESTAMP COMMENT '记录时间',
24 | place_id int(11) UNSIGNED NOT NULL DEFAULT '00000' COMMENT '设备id',
25 | stu_id int(1) int(11) UNSIGNED NOT NULL DEFAULT '00000' COMMENT '学生id',
26 | PRIMARY KEY (record_id)
27 | ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
28 |
29 | DROP TABLE IF EXISTS `place_table`;
30 | CREATE TABLE `place_table` (
31 | place_id int,
32 | place_name varchar(32) DEFAULT NULL COMMENT '地点名字',
33 | place_time timestamp DEFAULT CURRENT_TIMESTAMP COMMENT '记录时间',
34 | foreign key(place_id) references access_record_table(place_id) on delete cascade on update cascade
35 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
36 |
37 | DROP TABLE IF EXISTS `stu_table`;
38 | CREATE TABLE `stu_table` (
39 | stu_id int,
40 | stu_name varchar(32) DEFAULT NULL COMMENT '学生名字',
41 | stu_status enum('0','1','2') NOT NULL DEFAULT '0' COMMENT '学生状态',
42 | stu_times timestamp DEFAULT CURRENT_TIMESTAMP COMMENT '记录时间',
43 | foreign key(stu_id) references access_record_table(stu_id) on delete cascade on update cascade
44 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
45 |
46 | DROP TABLE IF EXISTS `usr_table`;
47 | CREATE TABLE `usr_table` (
48 | stu_id int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
49 | usr_name varchar(32) DEFAULT NULL COMMENT '用户名称',
50 | usr_pic varchar(32) DEFAULT NULL COMMENT '用户图片名称',
51 | usr_times timestamp DEFAULT CURRENT_TIMESTAMP COMMENT '记录时间',
52 | PRIMARY KEY (stu_id)
53 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
54 | ```
55 |
56 | ### 项目背景
57 | 智能校园防御软件是实现了一款基于摄像头数据采集、人脸识别、口罩识别、 数据统计的预警系统,该种防御系统能够通过人脸识别进行管理员登录打卡,通过安装在教室内的固定摄像头,实时采集教室内上课同学的图像,判断是否有带口罩,从而在监控屏幕中予以标记提示警卫人员。采用 OpenCV/爬虫数据采集、利用 Numpy、Pandas 及特征工程、模型聚合进行数据预处理、CNN 模型训练框架。
58 |
59 | ### 用例图功能概述
60 | 
61 |
62 | ### 项目系统框架MVC说明——输入
63 | 
64 |
65 | ### 项目系统框架MVC说明——反馈
66 | 
67 |
68 | ### 联系方式
69 | 本项目为本人练手项目,请勿商用,若有问题请自行解决。实在无法解决的,请将问题发送邮件至:2827709585@qq.com
70 | (看到就会回复)
71 |
72 | **最后更新时间:2022.04.11**
73 |
--------------------------------------------------------------------------------
/SystemSet.py:
--------------------------------------------------------------------------------
1 | from Global import CONFIG
2 |
3 |
4 | # 获取服务器相关设置信息
5 | def GetClientConf(info):
6 | return CONFIG["@client_config"][info]
7 |
8 |
9 | # 获取百度API相关信息
10 | def GetBaiDuConf(info):
11 | return CONFIG["@baidu_api"][info]
12 |
13 |
14 | # 获取mysql相关信息
15 | def GetMysqlConf(info):
16 | return CONFIG["@mysql_opt"][info]
17 |
18 |
19 | # 获取mode相关信息
20 | def GetModelConf(info):
21 | return CONFIG["@mask_detection"][info]
22 |
--------------------------------------------------------------------------------
/baiduAi.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from Global import CONFIG
3 | from aip import AipBodyAnalysis
4 | from aip import AipFace
5 |
6 |
7 | class CFaceId(object):
8 | def __init__(self, group_default='temp'):
9 | "输入APP_ID的值"
10 | self.APP_ID = CONFIG["@baidu_api"]["APP_ID"]
11 | "输入KEY的值"
12 | self.API_KEY = CONFIG["@baidu_api"]["API_KEY"]
13 | "输入SECRET_KEY的值"
14 | self.SECRET_KEY = CONFIG["@baidu_api"]["SECRET_KEY"]
15 | self.aipFace = AipFace(self.APP_ID, self.API_KEY, self.SECRET_KEY)
16 | self.bodyCheck = AipBodyAnalysis(self.APP_ID, self.API_KEY, self.SECRET_KEY)
17 | self.photo_name = ''
18 | self.group = group_default
19 |
20 | def getUser(self, user_id, group_id):
21 | """
22 | 获取用户的名称
23 | :param user_id: 用户ID
24 | :param group_id: 群组ID
25 | :return:用户名的结果,返回给上层封装进行处理
26 | """
27 | return self.aipFace.getUser(user_id, group_id)
28 |
29 | def GroupAdd(self, group_name):
30 | """
31 | 创建组用户
32 | :param group_name:组名
33 | :return: 创建的结果返回给上层防撞进行处理
34 | """
35 | res = self.aipFace.groupAdd(group_name)
36 | return res
37 |
38 | def FaceAdd(self, image, user_id, group_id='temp'):
39 | """
40 | 添加人脸
41 | :param image: 人脸图像base64
42 | :param user_id: 用户ID
43 | :param group_id: 组名, 默认为temp
44 | :return: 返回添加后的结果
45 | """
46 | result = self.aipFace.addUser(image, "BASE64", group_id, user_id)
47 | return result
48 |
49 | def FaceUpdate(self, image, user_id, group_id='temp'):
50 | """
51 | 更新人脸
52 | :param image:人脸图像 base64
53 | :param user_id: 用户ID
54 | :param group_id: 组名, 默认为temp
55 | :return: 返回更新后的结果
56 | """
57 | result = self.aipFace.addUser(image, "BASE64", group_id, user_id)
58 | return result
59 |
60 | def FaceSearch(self, image, image_type="BASE64", group_id="temp"):
61 | """
62 | 脸部搜索
63 | :param image: 图像的编码
64 | :param image_type: BASE-64
65 | :param group_id: 群组ID,默认为temp
66 | :return:
67 | """
68 | # image 为base64字符串
69 | options = {
70 | "match_threshold": 75,
71 | "liveness_control": "NORMAL",
72 | "quality_control": "NORMAL"
73 | }
74 | return self.aipFace.search(image, image_type, group_id)
75 |
76 | def FaceMultiSearch(self, image, image_type="BASE64", group_id="temp"):
77 | """
78 | 1张图片多个脸部搜索
79 | :param image:
80 | :param image_type:
81 | :param group_id:
82 | :return:获取的结果
83 | """
84 | # image 为base64字符串
85 | options = {
86 | "max_face_num": 10,
87 | "quality_control": "NORMAL"
88 | }
89 | return self.aipFace.multiSearch(image, image_type, group_id, options)
90 |
91 | def GetUser(self, uid, group='temp'):
92 | """
93 | 获取用户名
94 | :param uid: 用户ID
95 | :param group: 组ID
96 | :return: 获取的结果
97 | """
98 | result = self.aipFace.getUser(uid, group)
99 | print(result)
100 |
101 | def GetGroup(self, start=0, num=100):
102 | """
103 | 获取组内的组列表
104 | :param start: 其实位置
105 | :param num:数量
106 | :return:结果
107 | """
108 | options = {
109 | 'start': start,
110 | 'num': num
111 | }
112 | result = self.aipFace.getGroupList(options)
113 | print(result)
114 |
115 | def GetGroupUser(self, group='temp', start=0, num=100):
116 | """
117 | 获取组内用户列表
118 | :param group: 组名
119 | :param start: 起始名
120 | :param num: 终止名
121 | :return: 返回值
122 | """
123 | options = {
124 | 'start': start,
125 | 'num': num
126 | }
127 | result = self.aipFace.getGroupUsers(group, options)
128 | return result
129 |
130 | def DelUser(self, uid):
131 | """
132 | 删除用户
133 | :param uid:用户ID
134 | :return:删除的结果
135 | """
136 | result = self.aipFace.deleteUser(uid)
137 | return result
138 |
139 | def BodyTracking(self, image, is_init, area):
140 | """
141 | 身体追踪
142 | :param image: 图像信息
143 | :param is_init: 初始化信心
144 | :param area: 定位的区域
145 | :return: 追踪的结果
146 | """
147 | dynamic = "true"
148 | options = {}
149 | options["case_id"] = 1
150 | options["case_init"] = is_init
151 | options["area"] = area
152 | result = self.bodyCheck.bodyTracking(image, dynamic, options)
153 | return result
154 |
--------------------------------------------------------------------------------
/config/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "@client_config": {
3 | "soft_version": "",
4 | "server_ip_add": "192.168.1.1",
5 | "server_ip_port": 8080,
6 | "model_save_addr": "model/",
7 | "system_storage_size": 1,
8 | "is_delete": 1,
9 | "error_image_path": "error_image/",
10 | "stu_face": "stu_face/"
11 | },
12 | "@baidu_api": {
13 | "APP_ID": "请自行修改",
14 | "API_KEY": "请自行修改",
15 | "SECRET_KEY": "请自行修改"
16 | },
17 | "@mysql_opt": {
18 | "mysql_db": "recordDB",
19 | "mysql_host": "47.98.60.15",
20 | "mysql_port": 3306,
21 | "mysql_user": "root",
22 | "mysql_pwd": "000000",
23 | "mysql_charset": "utf8"
24 | },
25 | "@mask_detection": {
26 | "model_name": "model/train.model",
27 | "IMAGE_SIZE": 150,
28 | "LEARNING_RATE": 0.0001
29 | },
30 | "@Sqlite3": {
31 | "db_file": "dataBase/error_face.db"
32 | }
33 | }
--------------------------------------------------------------------------------
/dataBase/error_face.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/dataBase/error_face.db
--------------------------------------------------------------------------------
/dataBase/error_face.sql:
--------------------------------------------------------------------------------
1 | --=============================================================================================================
2 | -- 创建数据库
3 | CREATE DATABASE IF NOT EXISTS `recordDB`;
4 |
5 | --错误数据信息表error_record_table:
6 | DROP TABLE IF EXISTS `error_record_table`;
7 | CREATE TABLE IF NOT EXISTS `error_record_table`
8 | (
9 | "error_id" integer NOT NULL PRIMARY KEY autoincrement,
10 | "error_time" TimeStamp NOT NULL DEFAULT (datetime('now','localtime')),
11 | "error_type" integer(1) NOT NULL
12 | );
13 | -- 1表示带口罩被识别未没带口罩, 0表示没带口罩被识别为带口罩
14 | --INSERT INTO error_record_table(error_type) values (0);
--------------------------------------------------------------------------------
/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/icon.ico
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from win.CStartWin import *
3 | from PyQt5 import QtWidgets
4 |
5 | if __name__ == "__main__":
6 | app = QtWidgets.QApplication(sys.argv)
7 | login_show = CStartWin()
8 | login_show.show()
9 | sys.exit(app.exec_())
10 |
--------------------------------------------------------------------------------
/main.spec:
--------------------------------------------------------------------------------
1 | # -*- mode: python ; coding: utf-8 -*-
2 | import sys # 导入sys模块
3 | sys.setrecursionlimit(3000) # 将默认的递归深度修改为3000
4 |
5 | block_cipher = None
6 |
7 |
8 | a = Analysis(['main.py'],
9 | pathex=['D:\\Desktop\\security\\src'],
10 | binaries=[],
11 | datas=[],
12 | hiddenimports=[],
13 | hookspath=[],
14 | runtime_hooks=[],
15 | excludes=[],
16 | win_no_prefer_redirects=False,
17 | win_private_assemblies=False,
18 | cipher=block_cipher,
19 | noarchive=False)
20 | pyz = PYZ(a.pure, a.zipped_data,
21 | cipher=block_cipher)
22 | exe = EXE(pyz,
23 | a.scripts,
24 | [],
25 | exclude_binaries=True,
26 | name='main',
27 | debug=False,
28 | bootloader_ignore_signals=False,
29 | strip=False,
30 | upx=True,
31 | console=False , icon='icon.ico')
32 | coll = COLLECT(exe,
33 | a.binaries,
34 | a.zipfiles,
35 | a.datas,
36 | strip=False,
37 | upx=True,
38 | upx_exclude=[],
39 | name='main')
40 |
--------------------------------------------------------------------------------
/ui_file/__pycache__/resource_rc.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/__pycache__/resource_rc.cpython-37.pyc
--------------------------------------------------------------------------------
/ui_file/__pycache__/ui_login.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/__pycache__/ui_login.cpython-37.pyc
--------------------------------------------------------------------------------
/ui_file/__pycache__/ui_main.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/__pycache__/ui_main.cpython-37.pyc
--------------------------------------------------------------------------------
/ui_file/__pycache__/ui_reg.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/__pycache__/ui_reg.cpython-37.pyc
--------------------------------------------------------------------------------
/ui_file/__pycache__/ui_start.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/__pycache__/ui_start.cpython-37.pyc
--------------------------------------------------------------------------------
/ui_file/main.pyproject:
--------------------------------------------------------------------------------
1 | {
2 | "files": ["ui_reg.ui","resource.qrc","ui_main.ui","ui_start.ui","ui_login.ui","main.py","resource_rc.qrc"]
3 | }
4 |
--------------------------------------------------------------------------------
/ui_file/main.pyproject.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | EnvironmentId
7 | {e193098a-d2b9-4a43-a4db-541212dc1b83}
8 |
9 |
10 | ProjectExplorer.Project.ActiveTarget
11 | 0
12 |
13 |
14 | ProjectExplorer.Project.EditorSettings
15 |
16 | true
17 | false
18 | true
19 |
20 | Cpp
21 |
22 | CppGlobal
23 |
24 |
25 |
26 | QmlJS
27 |
28 | QmlJSGlobal
29 |
30 |
31 | 2
32 | UTF-8
33 | false
34 | 4
35 | false
36 | 80
37 | true
38 | true
39 | 1
40 | true
41 | false
42 | 0
43 | true
44 | true
45 | 0
46 | 8
47 | true
48 | 1
49 | true
50 | true
51 | true
52 | *.md, *.MD, Makefile
53 | false
54 | true
55 |
56 |
57 |
58 | ProjectExplorer.Project.PluginSettings
59 |
60 |
61 | true
62 | true
63 | true
64 | true
65 | true
66 |
67 |
68 | 0
69 | true
70 |
71 | -fno-delayed-template-parsing
72 |
73 | true
74 | Builtin.Questionable
75 |
76 | true
77 | Builtin.DefaultTidyAndClazy
78 | 4
79 |
80 |
81 |
82 | true
83 |
84 |
85 |
86 |
87 | ProjectExplorer.Project.Target.0
88 |
89 | Desktop
90 | Desktop Qt 5.15.1 MinGW 32-bit
91 | Desktop Qt 5.15.1 MinGW 32-bit
92 | qt.qt5.5151.win32_mingw81_kit
93 | -1
94 | 0
95 | 0
96 | 0
97 |
98 |
99 | 0
100 | Deploy
101 | Deploy
102 | ProjectExplorer.BuildSteps.Deploy
103 |
104 | 1
105 |
106 | false
107 | ProjectExplorer.DefaultDeployConfiguration
108 |
109 | 1
110 |
111 |
112 | dwarf
113 |
114 | cpu-cycles
115 |
116 |
117 | 250
118 |
119 | -e
120 | cpu-cycles
121 | --call-graph
122 | dwarf,4096
123 | -F
124 | 250
125 |
126 | -F
127 | true
128 | 4096
129 | false
130 | false
131 | 1000
132 |
133 | true
134 |
135 | false
136 | false
137 | false
138 | false
139 | true
140 | 0.01
141 | 10
142 | true
143 | kcachegrind
144 | 1
145 | 25
146 |
147 | 1
148 | true
149 | false
150 | true
151 | valgrind
152 |
153 | 0
154 | 1
155 | 2
156 | 3
157 | 4
158 | 5
159 | 6
160 | 7
161 | 8
162 | 9
163 | 10
164 | 11
165 | 12
166 | 13
167 | 14
168 |
169 |
170 | 2
171 |
172 |
173 | ProjectExplorer.CustomExecutableRunConfiguration
174 |
175 |
176 | false
177 |
178 | false
179 | true
180 | false
181 | false
182 | true
183 |
184 |
185 |
186 | 1
187 |
188 |
189 |
190 | ProjectExplorer.Project.TargetCount
191 | 1
192 |
193 |
194 | ProjectExplorer.Project.Updater.FileVersion
195 | 22
196 |
197 |
198 | Version
199 | 22
200 |
201 |
202 |
--------------------------------------------------------------------------------
/ui_file/resource/icon/check-circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/check-circle.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/decide.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/decide.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/icon.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/login.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/redo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/redo.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/switchOff.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/switchOff.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/switchOffHover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/switchOffHover.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/switchOffPressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/switchOffPressed.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/switchOn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/switchOn.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/title.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/title.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/人脸核身.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/人脸核身.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/人脸识别.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/人脸识别.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/图片.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/图片.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/多云.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/多云.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/导入.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/导入.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/打勾_有圈.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/打勾_有圈.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/拉钩.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/拉钩.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/提醒,感叹号_jurassic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/提醒,感叹号_jurassic.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/时间.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/时间.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/注册.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/注册.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/爸爸.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/爸爸.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/用户.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/用户.png
--------------------------------------------------------------------------------
/ui_file/resource/icon/返回.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/icon/返回.png
--------------------------------------------------------------------------------
/ui_file/resource/img/Dark_人脸识别.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/img/Dark_人脸识别.png
--------------------------------------------------------------------------------
/ui_file/resource/img/background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/img/background.jpg
--------------------------------------------------------------------------------
/ui_file/resource/img/background1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/img/background1.jpg
--------------------------------------------------------------------------------
/ui_file/resource/img/background2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/img/background2.jpg
--------------------------------------------------------------------------------
/ui_file/resource/img/background3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/img/background3.jpg
--------------------------------------------------------------------------------
/ui_file/resource/img/background4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/img/background4.jpg
--------------------------------------------------------------------------------
/ui_file/resource/img/background5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/img/background5.jpg
--------------------------------------------------------------------------------
/ui_file/resource/img/board.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/img/board.png
--------------------------------------------------------------------------------
/ui_file/resource/img/border.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/img/border.jpg
--------------------------------------------------------------------------------
/ui_file/resource/img/color.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/img/color.jpg
--------------------------------------------------------------------------------
/ui_file/resource/img/green.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/img/green.jpg
--------------------------------------------------------------------------------
/ui_file/resource/img/main.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/img/main.jpg
--------------------------------------------------------------------------------
/ui_file/resource/img/reg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/ui_file/resource/img/reg.jpg
--------------------------------------------------------------------------------
/ui_file/resource/qss_file/Aqua.qss:
--------------------------------------------------------------------------------
1 | /*
2 | Aqua Style Sheet for QT Applications
3 | Author: Jaime A. Quiroga P.
4 | Company: GTRONICK
5 | Last updated: 22/01/2019, 07:55.
6 | Available at: https://github.com/GTRONICK/QSS/blob/master/Aqua.qss
7 | */
8 | QMainWindow {
9 | background-color:#ececec;
10 | }
11 | QTextEdit {
12 | border-width: 1px;
13 | border-style: solid;
14 | border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255));
15 | }
16 | QPlainTextEdit {
17 | border-width: 1px;
18 | border-style: solid;
19 | border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255));
20 | }
21 | QToolButton {
22 | border-style: solid;
23 | border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222));
24 | border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227));
25 | border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217));
26 | border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222));
27 | border-width: 1px;
28 | border-radius: 5px;
29 | color: rgb(0,0,0);
30 | padding: 2px;
31 | background-color: rgb(255,255,255);
32 | }
33 | QToolButton:hover{
34 | border-style: solid;
35 | border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222));
36 | border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(197, 197, 197), stop:1 rgb(227, 227, 227));
37 | border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(197, 197, 197));
38 | border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222));
39 | border-width: 1px;
40 | border-radius: 5px;
41 | color: rgb(0,0,0);
42 | padding: 2px;
43 | background-color: rgb(255,255,255);
44 | }
45 | QToolButton:pressed{
46 | border-style: solid;
47 | border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222));
48 | border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227));
49 | border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217));
50 | border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222));
51 | border-width: 1px;
52 | border-radius: 5px;
53 | color: rgb(0,0,0);
54 | padding: 2px;
55 | background-color: rgb(142,142,142);
56 | }
57 | QPushButton{
58 | border-style: solid;
59 | border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222));
60 | border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227));
61 | border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217));
62 | border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222));
63 | border-width: 1px;
64 | border-radius: 5px;
65 | color: rgb(0,0,0);
66 | padding: 2px;
67 | background-color: rgb(255,255,255);
68 | }
69 | QPushButton::default{
70 | border-style: solid;
71 | border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222));
72 | border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227));
73 | border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217));
74 | border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222));
75 | border-width: 1px;
76 | border-radius: 5px;
77 | color: rgb(0,0,0);
78 | padding: 2px;
79 | background-color: rgb(255,255,255);
80 | }
81 | QPushButton:hover{
82 | border-style: solid;
83 | border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222));
84 | border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(197, 197, 197), stop:1 rgb(227, 227, 227));
85 | border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(197, 197, 197));
86 | border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(195, 195, 195), stop:1 rgb(222, 222, 222));
87 | border-width: 1px;
88 | border-radius: 5px;
89 | color: rgb(0,0,0);
90 | padding: 2px;
91 | background-color: rgb(255,255,255);
92 | }
93 | QPushButton:pressed{
94 | border-style: solid;
95 | border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222));
96 | border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227));
97 | border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217));
98 | border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222));
99 | border-width: 1px;
100 | border-radius: 5px;
101 | color: rgb(0,0,0);
102 | padding: 2px;
103 | background-color: rgb(142,142,142);
104 | }
105 | QPushButton:disabled{
106 | border-style: solid;
107 | border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222));
108 | border-right-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(217, 217, 217), stop:1 rgb(227, 227, 227));
109 | border-left-color: qlineargradient(spread:pad, x1:0, y1:0.5, x2:1, y2:0.5, stop:0 rgb(227, 227, 227), stop:1 rgb(217, 217, 217));
110 | border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgb(215, 215, 215), stop:1 rgb(222, 222, 222));
111 | border-width: 1px;
112 | border-radius: 5px;
113 | color: #808086;
114 | padding: 2px;
115 | background-color: rgb(142,142,142);
116 | }
117 | QLineEdit {
118 | border-width: 1px; border-radius: 4px;
119 | border-style: solid;
120 | border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255));
121 | }
122 | QLabel {
123 | color: #000000;
124 | }
125 | QLCDNumber {
126 | color: rgb(0, 113, 255, 255);
127 | }
128 | QProgressBar {
129 | text-align: center;
130 | color: rgb(240, 240, 240);
131 | border-width: 1px;
132 | border-radius: 10px;
133 | border-color: rgb(230, 230, 230);
134 | border-style: solid;
135 | background-color:rgb(207,207,207);
136 | }
137 | QProgressBar::chunk {
138 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(49, 147, 250, 255), stop:1 rgba(34, 142, 255, 255));
139 | border-radius: 10px;
140 | }
141 | QMenuBar {
142 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(207, 209, 207, 255), stop:1 rgba(230, 229, 230, 255));
143 | }
144 | QMenuBar::item {
145 | color: #000000;
146 | spacing: 3px;
147 | padding: 1px 4px;
148 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(207, 209, 207, 255), stop:1 rgba(230, 229, 230, 255));
149 | }
150 |
151 | QMenuBar::item:selected {
152 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255));
153 | color: #FFFFFF;
154 | }
155 | QMenu::item:selected {
156 | border-style: solid;
157 | border-top-color: transparent;
158 | border-right-color: transparent;
159 | border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255));
160 | border-bottom-color: transparent;
161 | border-left-width: 2px;
162 | color: #000000;
163 | padding-left:15px;
164 | padding-top:4px;
165 | padding-bottom:4px;
166 | padding-right:7px;
167 | }
168 | QMenu::item {
169 | border-style: solid;
170 | border-top-color: transparent;
171 | border-right-color: transparent;
172 | border-left-color: transparent;
173 | border-bottom-color: transparent;
174 | border-bottom-width: 1px;
175 | color: #000000;
176 | padding-left:17px;
177 | padding-top:4px;
178 | padding-bottom:4px;
179 | padding-right:7px;
180 | }
181 | QTabWidget {
182 | color:rgb(0,0,0);
183 | background-color:#000000;
184 | }
185 | QTabWidget::pane {
186 | border-color: rgb(223,223,223);
187 | background-color:rgb(226,226,226);
188 | border-style: solid;
189 | border-width: 2px;
190 | border-radius: 6px;
191 | }
192 | QTabBar::tab:first {
193 | border-style: solid;
194 | border-left-width:1px;
195 | border-right-width:0px;
196 | border-top-width:1px;
197 | border-bottom-width:1px;
198 | border-top-color: rgb(209,209,209);
199 | border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229));
200 | border-bottom-color: rgb(229,229,229);
201 | border-top-left-radius: 4px;
202 | border-bottom-left-radius: 4px;
203 | color: #000000;
204 | padding: 3px;
205 | margin-left:0px;
206 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(247, 247, 247, 255), stop:1 rgba(255, 255, 255, 255));
207 | }
208 | QTabBar::tab:last {
209 | border-style: solid;
210 | border-width:1px;
211 | border-top-color: rgb(209,209,209);
212 | border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229));
213 | border-right-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229));
214 | border-bottom-color: rgb(229,229,229);
215 | border-top-right-radius: 4px;
216 | border-bottom-right-radius: 4px;
217 | color: #000000;
218 | padding: 3px;
219 | margin-left:0px;
220 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(247, 247, 247, 255), stop:1 rgba(255, 255, 255, 255));
221 | }
222 | QTabBar::tab {
223 | border-style: solid;
224 | border-top-width:1px;
225 | border-bottom-width:1px;
226 | border-left-width:1px;
227 | border-top-color: rgb(209,209,209);
228 | border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229));
229 | border-bottom-color: rgb(229,229,229);
230 | color: #000000;
231 | padding: 3px;
232 | margin-left:0px;
233 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(247, 247, 247, 255), stop:1 rgba(255, 255, 255, 255));
234 | }
235 | QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover {
236 | border-style: solid;
237 | border-left-width:1px;
238 | border-right-color: transparent;
239 | border-top-color: rgb(209,209,209);
240 | border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229));
241 | border-bottom-color: rgb(229,229,229);
242 | color: #FFFFFF;
243 | padding: 3px;
244 | margin-left:0px;
245 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255));
246 | }
247 |
248 | QTabBar::tab:selected, QTabBar::tab:first:selected, QTabBar::tab:hover {
249 | border-style: solid;
250 | border-left-width:1px;
251 | border-bottom-width:1px;
252 | border-top-width:1px;
253 | border-right-color: transparent;
254 | border-top-color: rgb(209,209,209);
255 | border-left-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(209, 209, 209, 209), stop:1 rgba(229, 229, 229, 229));
256 | border-bottom-color: rgb(229,229,229);
257 | color: #FFFFFF;
258 | padding: 3px;
259 | margin-left:0px;
260 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255));
261 | }
262 |
263 | QCheckBox {
264 | color: #000000;
265 | padding: 2px;
266 | }
267 | QCheckBox:disabled {
268 | color: #808086;
269 | padding: 2px;
270 | }
271 |
272 | QCheckBox:hover {
273 | border-radius:4px;
274 | border-style:solid;
275 | padding-left: 1px;
276 | padding-right: 1px;
277 | padding-bottom: 1px;
278 | padding-top: 1px;
279 | border-width:1px;
280 | border-color: transparent;
281 | }
282 | QCheckBox::indicator:checked {
283 |
284 | height: 10px;
285 | width: 10px;
286 | border-style:solid;
287 | border-width: 1px;
288 | border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255));
289 | color: #000000;
290 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255));
291 | }
292 | QCheckBox::indicator:unchecked {
293 |
294 | height: 10px;
295 | width: 10px;
296 | border-style:solid;
297 | border-width: 1px;
298 | border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255));
299 | color: #000000;
300 | }
301 | QRadioButton {
302 | color: 000000;
303 | padding: 1px;
304 | }
305 | QRadioButton::indicator:checked {
306 | height: 10px;
307 | width: 10px;
308 | border-style:solid;
309 | border-radius:5px;
310 | border-width: 1px;
311 | border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255));
312 | color: #a9b7c6;
313 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255));
314 | }
315 | QRadioButton::indicator:!checked {
316 | height: 10px;
317 | width: 10px;
318 | border-style:solid;
319 | border-radius:5px;
320 | border-width: 1px;
321 | border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255));
322 | color: #a9b7c6;
323 | background-color: transparent;
324 | }
325 | QStatusBar {
326 | color:#027f7f;
327 | }
328 | QSpinBox {
329 | border-style: solid;
330 | border-width: 1px;
331 | border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255));
332 | }
333 | QDoubleSpinBox {
334 | border-style: solid;
335 | border-width: 1px;
336 | border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255));
337 | }
338 | QTimeEdit {
339 | border-style: solid;
340 | border-width: 1px;
341 | border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255));
342 | }
343 | QDateTimeEdit {
344 | border-style: solid;
345 | border-width: 1px;
346 | border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255));
347 | }
348 | QDateEdit {
349 | border-style: solid;
350 | border-width: 1px;
351 | border-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(0, 113, 255, 255), stop:1 rgba(91, 171, 252, 255));
352 | }
353 |
354 | QToolBox {
355 | color: #a9b7c6;
356 | background-color:#000000;
357 | }
358 | QToolBox::tab {
359 | color: #a9b7c6;
360 | background-color:#000000;
361 | }
362 | QToolBox::tab:selected {
363 | color: #FFFFFF;
364 | background-color:#000000;
365 | }
366 | QScrollArea {
367 | color: #FFFFFF;
368 | background-color:#000000;
369 | }
370 | QSlider::groove:horizontal {
371 | height: 5px;
372 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(49, 147, 250, 255), stop:1 rgba(34, 142, 255, 255));
373 | }
374 | QSlider::groove:vertical {
375 | width: 5px;
376 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(49, 147, 250, 255), stop:1 rgba(34, 142, 255, 255));
377 | }
378 | QSlider::handle:horizontal {
379 | background: rgb(253,253,253);
380 | border-style: solid;
381 | border-width: 1px;
382 | border-color: rgb(207,207,207);
383 | width: 12px;
384 | margin: -5px 0;
385 | border-radius: 7px;
386 | }
387 | QSlider::handle:vertical {
388 | background: rgb(253,253,253);
389 | border-style: solid;
390 | border-width: 1px;
391 | border-color: rgb(207,207,207);
392 | height: 12px;
393 | margin: 0 -5px;
394 | border-radius: 7px;
395 | }
396 | QSlider::add-page:horizontal {
397 | background: rgb(181,181,181);
398 | }
399 | QSlider::add-page:vertical {
400 | background: rgb(181,181,181);
401 | }
402 | QSlider::sub-page:horizontal {
403 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(49, 147, 250, 255), stop:1 rgba(34, 142, 255, 255));
404 | }
405 | QSlider::sub-page:vertical {
406 | background-color: qlineargradient(spread:pad, y1:0.5, x1:1, y2:0.5, x2:0, stop:0 rgba(49, 147, 250, 255), stop:1 rgba(34, 142, 255, 255));
407 | }
408 | QScrollBar:horizontal {
409 | max-height: 20px;
410 | border: 1px transparent grey;
411 | margin: 0px 20px 0px 20px;
412 | }
413 | QScrollBar:vertical {
414 | max-width: 20px;
415 | border: 1px transparent grey;
416 | margin: 20px 0px 20px 0px;
417 | }
418 | QScrollBar::handle:horizontal {
419 | background: rgb(253,253,253);
420 | border-style: solid;
421 | border-width: 1px;
422 | border-color: rgb(207,207,207);
423 | border-radius: 7px;
424 | min-width: 25px;
425 | }
426 | QScrollBar::handle:horizontal:hover {
427 | background: rgb(253,253,253);
428 | border-style: solid;
429 | border-width: 1px;
430 | border-color: rgb(147, 200, 200);
431 | border-radius: 7px;
432 | min-width: 25px;
433 | }
434 | QScrollBar::handle:vertical {
435 | background: rgb(253,253,253);
436 | border-style: solid;
437 | border-width: 1px;
438 | border-color: rgb(207,207,207);
439 | border-radius: 7px;
440 | min-height: 25px;
441 | }
442 | QScrollBar::handle:vertical:hover {
443 | background: rgb(253,253,253);
444 | border-style: solid;
445 | border-width: 1px;
446 | border-color: rgb(147, 200, 200);
447 | border-radius: 7px;
448 | min-height: 25px;
449 | }
450 | QScrollBar::add-line:horizontal {
451 | border: 2px transparent grey;
452 | border-top-right-radius: 7px;
453 | border-bottom-right-radius: 7px;
454 | background: rgba(34, 142, 255, 255);
455 | width: 20px;
456 | subcontrol-position: right;
457 | subcontrol-origin: margin;
458 | }
459 | QScrollBar::add-line:horizontal:pressed {
460 | border: 2px transparent grey;
461 | border-top-right-radius: 7px;
462 | border-bottom-right-radius: 7px;
463 | background: rgb(181,181,181);
464 | width: 20px;
465 | subcontrol-position: right;
466 | subcontrol-origin: margin;
467 | }
468 | QScrollBar::add-line:vertical {
469 | border: 2px transparent grey;
470 | border-bottom-left-radius: 7px;
471 | border-bottom-right-radius: 7px;
472 | background: rgba(34, 142, 255, 255);
473 | height: 20px;
474 | subcontrol-position: bottom;
475 | subcontrol-origin: margin;
476 | }
477 | QScrollBar::add-line:vertical:pressed {
478 | border: 2px transparent grey;
479 | border-bottom-left-radius: 7px;
480 | border-bottom-right-radius: 7px;
481 | background: rgb(181,181,181);
482 | height: 20px;
483 | subcontrol-position: bottom;
484 | subcontrol-origin: margin;
485 | }
486 | QScrollBar::sub-line:horizontal {
487 | border: 2px transparent grey;
488 | border-top-left-radius: 7px;
489 | border-bottom-left-radius: 7px;
490 | background: rgba(34, 142, 255, 255);
491 | width: 20px;
492 | subcontrol-position: left;
493 | subcontrol-origin: margin;
494 | }
495 | QScrollBar::sub-line:horizontal:pressed {
496 | border: 2px transparent grey;
497 | border-top-left-radius: 7px;
498 | border-bottom-left-radius: 7px;
499 | background: rgb(181,181,181);
500 | width: 20px;
501 | subcontrol-position: left;
502 | subcontrol-origin: margin;
503 | }
504 | QScrollBar::sub-line:vertical {
505 | border: 2px transparent grey;
506 | border-top-left-radius: 7px;
507 | border-top-right-radius: 7px;
508 | background: rgba(34, 142, 255, 255);
509 | height: 20px;
510 | subcontrol-position: top;
511 | subcontrol-origin: margin;
512 | }
513 | QScrollBar::sub-line:vertical:pressed {
514 | border: 2px transparent grey;
515 | border-top-left-radius: 7px;
516 | border-top-right-radius: 7px;
517 | background: rgb(181,181,181);
518 | height: 20px;
519 | subcontrol-position: top;
520 | subcontrol-origin: margin;
521 | }
522 | QScrollBar::left-arrow:horizontal {
523 | border: 1px transparent grey;
524 | border-top-left-radius: 3px;
525 | border-bottom-left-radius: 3px;
526 | width: 6px;
527 | height: 6px;
528 | background: white;
529 | }
530 | QScrollBar::right-arrow:horizontal {
531 | border: 1px transparent grey;
532 | border-top-right-radius: 3px;
533 | border-bottom-right-radius: 3px;
534 | width: 6px;
535 | height: 6px;
536 | background: white;
537 | }
538 | QScrollBar::up-arrow:vertical {
539 | border: 1px transparent grey;
540 | border-top-left-radius: 3px;
541 | border-top-right-radius: 3px;
542 | width: 6px;
543 | height: 6px;
544 | background: white;
545 | }
546 | QScrollBar::down-arrow:vertical {
547 | border: 1px transparent grey;
548 | border-bottom-left-radius: 3px;
549 | border-bottom-right-radius: 3px;
550 | width: 6px;
551 | height: 6px;
552 | background: white;
553 | }
554 | QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {
555 | background: none;
556 | }
557 | QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
558 | background: none;
559 | }
--------------------------------------------------------------------------------
/ui_file/resource/qss_file/QPushbtn.qss:
--------------------------------------------------------------------------------
1 | QPushButton{
2 | border-style: solid;
3 | border-top-color: black;
4 | border-right-color: black;
5 | border-left-color: black;
6 | border-bottom-color: black;
7 | border-width: 1px;
8 | border-radius: 5px;
9 | color: rgb(0,0,0);
10 | padding: 2px;
11 | background-color: rgb(255,255,255);
12 | box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
13 | width: 150px;
14 | }
15 | QPushButton::default{
16 | border-style: solid;
17 | border-top-color: black;
18 | border-right-color: black;
19 | border-left-color: black;
20 | border-bottom-color: black;
21 | border-radius: 5px;
22 | color: rgb(0,0,0);
23 | padding: 2px;
24 | background-color: rgb(255,255,255);
25 | box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
26 | }
27 | QPushButton:hover{
28 | border-style: solid;
29 | border-top-color: black;
30 | border-right-color: black;
31 | border-left-color: black;
32 | border-bottom-color: black;
33 | border-radius: 5px;
34 | color: rgb(0,0,0);
35 | padding: 2px;
36 | background-color: rgb(255,255,255);
37 | box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
38 | }
39 | QPushButton:pressed{
40 | border-style: solid;
41 | border-top-color: black;
42 | border-right-color: black;
43 | border-left-color: black;
44 | border-bottom-color: black;
45 | border-radius: 5px;
46 | color: rgb(0,0,0);
47 | padding: 2px;
48 | background-color: rgb(142,142,142);
49 | box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
50 | }
--------------------------------------------------------------------------------
/ui_file/resource/qss_file/start.qss:
--------------------------------------------------------------------------------
1 | /*设置登录窗口的大小*/
2 | QWidget#LoginWidget{
3 | width: 640px;
4 | height: 440px;
5 | }
6 | /*设置背景图片大小和样式*/
7 | #LoginWidget #label_background{
8 | width: 640px;
9 | height: 440px;
10 | background-image:url(data/images/login/back.png);
11 | }
12 | /*设置软件名称的字体样式*/
13 | QLabel#label_title
14 | {
15 | font:bold 21pt;
16 | color:#ffffff;
17 | background:transparent;
18 | }
19 | /*设置用户名和密码输出窗口的样式*/
20 | #LoginWidget QLineEdit
21 | {
22 | font:14px;
23 | color:#000000;
24 | }
25 |
26 | #LoginWidget #lineEdit_loginName,#lineEdit_loginPW
27 | {
28 | width:269px;
29 | min-height:38px;
30 | border-width:0;
31 | border-style:outset;
32 | }
33 |
34 | #LoginWidget #lineEdit_loginName:hover,#lineEdit_loginPW:hover
35 | {
36 | width:269px;
37 | min-height:38px;
38 | }
39 |
40 | #LoginWidget #lineEdit_loginName:focus,#lineEdit_loginPW:focus
41 | {
42 | width:269px;
43 | min-height:38px;
44 | }
45 |
46 | /*设置关闭按钮的样式*/
47 | #LoginWidget #pushButton_close
48 | {
49 | width:30px;
50 | min-height:30px;
51 | background-image:url(data/images/login/close-30.png);
52 | border:none;
53 | }
54 |
55 | #LoginWidget #pushButton_close:hover
56 | {
57 | background-image:url(data/images/login/close-30-hover.png);
58 | border:none;
59 | }
60 |
61 | #LoginWidget #pushButton_close:pressed
62 | {
63 | background-image:url(data/images/login/close-30-press.png);
64 | border:none;
65 | }
66 |
67 | /*设置登录按钮的样式*/
68 | QPushButton#pushButton_OK
69 | {
70 | font-size:14px;
71 | color:#1d4181;
72 | border-radius:2px;
73 | border:1px solid #1d4181;
74 | background:#bbc4dc;
75 | }
76 |
77 | QPushButton#pushButton_OK:hover
78 | {
79 | background:#d9dde4;
80 | }
81 |
82 | QPushButton#pushButton_OK:pressed
83 | {
84 | color:#ffffff;
85 | background:#2b4d8a;
86 | }
87 |
--------------------------------------------------------------------------------
/ui_file/resource_rc.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | resource/qss_file/Aqua.qss
4 | resource/qss_file/start.qss
5 | resource/img/border.jpg
6 | resource/img/Dark_人脸识别.png
7 | resource/img/main.jpg
8 | resource/img/reg.jpg
9 | resource/icon/check-circle.png
10 | resource/icon/login.png
11 | resource/icon/redo.png
12 | resource/icon/title.png
13 | resource/icon/爸爸.png
14 | resource/icon/返回.png
15 | resource/icon/拉钩.png
16 | resource/icon/人脸核身.png
17 | resource/icon/人脸识别.png
18 | resource/icon/图片.png
19 | resource/icon/多云.png
20 | resource/img/board.png
21 | resource/icon/注册.png
22 | resource/icon/时间.png
23 | resource/icon/用户.png
24 | resource/img/green.jpg
25 | resource/img/color.jpg
26 | resource/icon/打勾_有圈.png
27 | resource/icon/提醒,感叹号_jurassic.png
28 | resource/icon/switchOff.png
29 | resource/icon/switchOffHover.png
30 | resource/icon/switchOffPressed.png
31 | resource/icon/switchOn.png
32 | resource/icon/decide.png
33 | resource/icon/导入.png
34 |
35 |
36 |
--------------------------------------------------------------------------------
/ui_file/ui_login.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Form implementation generated from reading ui file 'ui_login.ui'
4 | #
5 | # Created by: PyQt5 UI code generator 5.15.4
6 | #
7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is
8 | # run again. Do not edit this file unless you know what you are doing.
9 |
10 |
11 | from PyQt5 import QtCore, QtGui, QtWidgets
12 |
13 |
14 | class Ui_login(object):
15 | def setupUi(self, login):
16 | login.setObjectName("login")
17 | login.resize(424, 735)
18 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored)
19 | sizePolicy.setHorizontalStretch(0)
20 | sizePolicy.setVerticalStretch(0)
21 | sizePolicy.setHeightForWidth(login.sizePolicy().hasHeightForWidth())
22 | login.setSizePolicy(sizePolicy)
23 | login.setAutoFillBackground(False)
24 | login.setStyleSheet("border-image: url(:/resource/img/color.jpg);\n"
25 | "QWidget#reg {\n"
26 | " border-top-left-radius: 15px;\n"
27 | " border-bottom-left-radius: 15px;\n"
28 | " border-top-right-radius: 15px;\n"
29 | " border-bottom-right-radius: 15px;\n"
30 | " border: 2px solid white; \n"
31 | "}")
32 | self.verticalLayout = QtWidgets.QVBoxLayout(login)
33 | self.verticalLayout.setContentsMargins(5, 5, 5, 20)
34 | self.verticalLayout.setObjectName("verticalLayout")
35 | self.label_title = QtWidgets.QLabel(login)
36 | font = QtGui.QFont()
37 | font.setFamily("Microsoft YaHei")
38 | font.setPointSize(25)
39 | font.setBold(True)
40 | font.setItalic(False)
41 | font.setWeight(75)
42 | self.label_title.setFont(font)
43 | self.label_title.setStyleSheet("color:white;\n"
44 | "font: 85 25pt \"Microsoft YaHei\";\n"
45 | "font-weight:bold;\n"
46 | "border-image:None;\n"
47 | "\n"
48 | "\n"
49 | "\n"
50 | "")
51 | self.label_title.setAlignment(QtCore.Qt.AlignCenter)
52 | self.label_title.setObjectName("label_title")
53 | self.verticalLayout.addWidget(self.label_title)
54 | self.line_2 = QtWidgets.QFrame(login)
55 | self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
56 | self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
57 | self.line_2.setObjectName("line_2")
58 | self.verticalLayout.addWidget(self.line_2)
59 | self.widget_cam = QtWidgets.QWidget(login)
60 | self.widget_cam.setStyleSheet("border-image: None;\n"
61 | "QWidget#widget_cam {\n"
62 | " border: 2px solid white;\n"
63 | " border-radius: 40px;\n"
64 | "}\n"
65 | "")
66 | self.widget_cam.setObjectName("widget_cam")
67 | self.gridLayout_2 = QtWidgets.QGridLayout(self.widget_cam)
68 | self.gridLayout_2.setContentsMargins(25, 10, 25, 10)
69 | self.gridLayout_2.setObjectName("gridLayout_2")
70 | self.label_cam = QtWidgets.QLabel(self.widget_cam)
71 | self.label_cam.setStyleSheet("border-radius: 20px;")
72 | self.label_cam.setText("")
73 | self.label_cam.setObjectName("label_cam")
74 | self.gridLayout_2.addWidget(self.label_cam, 0, 0, 1, 1)
75 | self.verticalLayout.addWidget(self.widget_cam)
76 | self.line = QtWidgets.QFrame(login)
77 | self.line.setFrameShape(QtWidgets.QFrame.HLine)
78 | self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
79 | self.line.setObjectName("line")
80 | self.verticalLayout.addWidget(self.line)
81 | self.widget_input = QtWidgets.QWidget(login)
82 | self.widget_input.setStyleSheet("border-image: None;")
83 | self.widget_input.setObjectName("widget_input")
84 | self.gridLayout = QtWidgets.QGridLayout(self.widget_input)
85 | self.gridLayout.setContentsMargins(50, 1, 50, 1)
86 | self.gridLayout.setHorizontalSpacing(2)
87 | self.gridLayout.setVerticalSpacing(5)
88 | self.gridLayout.setObjectName("gridLayout")
89 | self.gridLayout_3 = QtWidgets.QGridLayout()
90 | self.gridLayout_3.setObjectName("gridLayout_3")
91 | self.label = QtWidgets.QLabel(self.widget_input)
92 | self.label.setStyleSheet("border-image: url(:/resource/img/Dark_人脸识别.png);")
93 | self.label.setText("")
94 | self.label.setObjectName("label")
95 | self.gridLayout_3.addWidget(self.label, 1, 0, 2, 2)
96 | self.btn_reget = QtWidgets.QPushButton(self.widget_input)
97 | self.btn_reget.setMinimumSize(QtCore.QSize(75, 0))
98 | self.btn_reget.setMaximumSize(QtCore.QSize(100, 100))
99 | font = QtGui.QFont()
100 | font.setFamily("微软雅黑")
101 | font.setPointSize(-1)
102 | font.setUnderline(False)
103 | font.setStrikeOut(False)
104 | self.btn_reget.setFont(font)
105 | self.btn_reget.setStyleSheet("QPushButton\n"
106 | "{\n"
107 | " border-radius: 10px;\n"
108 | " padding:5px;\n"
109 | " text-align: center;\n"
110 | " text-decoration: none;\n"
111 | " font-size:14px;\n"
112 | " margin: 4px 2px;\n"
113 | " background-color: white;\n"
114 | " color:#1d4181;\n"
115 | " border:1px solid #1d4181;\n"
116 | "}\n"
117 | "QPushButton:hover \n"
118 | "{\n"
119 | " background-color: #008cba;\n"
120 | " color: white;\n"
121 | "}\n"
122 | "QPushButton:pressed \n"
123 | "{\n"
124 | " margin-top: -2px;\n"
125 | " margin-bottom:2px;\n"
126 | " \n"
127 | "}\n"
128 | "")
129 | icon = QtGui.QIcon()
130 | icon.addPixmap(QtGui.QPixmap(":/resource/icon/redo.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
131 | self.btn_reget.setIcon(icon)
132 | self.btn_reget.setObjectName("btn_reget")
133 | self.gridLayout_3.addWidget(self.btn_reget, 2, 2, 1, 1)
134 | self.btn_get_face = QtWidgets.QPushButton(self.widget_input)
135 | self.btn_get_face.setMinimumSize(QtCore.QSize(75, 0))
136 | self.btn_get_face.setMaximumSize(QtCore.QSize(100, 100))
137 | font = QtGui.QFont()
138 | font.setFamily("微软雅黑")
139 | font.setPointSize(-1)
140 | font.setUnderline(False)
141 | font.setStrikeOut(False)
142 | self.btn_get_face.setFont(font)
143 | self.btn_get_face.setStyleSheet("QPushButton\n"
144 | "{\n"
145 | " border-radius: 10px;\n"
146 | " padding:5px;\n"
147 | " text-align: center;\n"
148 | " text-decoration: none;\n"
149 | " font-size:14px;\n"
150 | " margin: 4px 2px;\n"
151 | " background-color: white;\n"
152 | " color:#1d4181;\n"
153 | " border:1px solid #1d4181;\n"
154 | "}\n"
155 | "QPushButton:hover \n"
156 | "{\n"
157 | " background-color: #008cba;\n"
158 | " color: white;\n"
159 | "}\n"
160 | "QPushButton:pressed \n"
161 | "{\n"
162 | " margin-top: -2px;\n"
163 | " margin-bottom:2px;\n"
164 | " \n"
165 | "}")
166 | icon1 = QtGui.QIcon()
167 | icon1.addPixmap(QtGui.QPixmap(":/resource/icon/人脸识别.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
168 | self.btn_get_face.setIcon(icon1)
169 | self.btn_get_face.setObjectName("btn_get_face")
170 | self.gridLayout_3.addWidget(self.btn_get_face, 1, 2, 1, 1)
171 | self.btn_connect = QtWidgets.QPushButton(self.widget_input)
172 | self.btn_connect.setMaximumSize(QtCore.QSize(180, 35))
173 | self.btn_connect.setStyleSheet("QPushButton\n"
174 | "{\n"
175 | " border-radius: 10px;\n"
176 | " padding:5px;\n"
177 | " text-align: center;\n"
178 | " text-decoration: none;\n"
179 | " font-size:12px;\n"
180 | " margin: 4px 2px;\n"
181 | " background-color: white;\n"
182 | " color:#1d4181;\n"
183 | " border:1px solid black;\n"
184 | "}")
185 | icon2 = QtGui.QIcon()
186 | icon2.addPixmap(QtGui.QPixmap(":/resource/icon/提醒,感叹号_jurassic.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
187 | self.btn_connect.setIcon(icon2)
188 | self.btn_connect.setObjectName("btn_connect")
189 | self.gridLayout_3.addWidget(self.btn_connect, 0, 1, 1, 1)
190 | self.gridLayout_3.setRowStretch(0, 1)
191 | self.gridLayout.addLayout(self.gridLayout_3, 0, 0, 1, 2)
192 | self.verticalLayout.addWidget(self.widget_input)
193 | self.layout_decide = QtWidgets.QHBoxLayout()
194 | self.layout_decide.setContentsMargins(50, -1, 50, -1)
195 | self.layout_decide.setSpacing(20)
196 | self.layout_decide.setObjectName("layout_decide")
197 | self.btn_decide = QtWidgets.QPushButton(login)
198 | self.btn_decide.setMaximumSize(QtCore.QSize(100, 40))
199 | font = QtGui.QFont()
200 | font.setFamily("微软雅黑")
201 | font.setPointSize(-1)
202 | self.btn_decide.setFont(font)
203 | self.btn_decide.setStyleSheet("\n"
204 | "QPushButton\n"
205 | "{\n"
206 | "font-size:16px;\n"
207 | "border-radius:16px;\n"
208 | "border:2px solid green;\n"
209 | "background:white;\n"
210 | "}\n"
211 | "QPushButton:hover \n"
212 | "{\n"
213 | " color:rgb(97, 97, 97)\n"
214 | "}\n"
215 | "QPushButton:pressed \n"
216 | "{\n"
217 | " margin-top: -2px;\n"
218 | " margin-bottom:2px;\n"
219 | " \n"
220 | "}")
221 | icon3 = QtGui.QIcon()
222 | icon3.addPixmap(QtGui.QPixmap(":/resource/icon/check-circle.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
223 | self.btn_decide.setIcon(icon3)
224 | self.btn_decide.setObjectName("btn_decide")
225 | self.layout_decide.addWidget(self.btn_decide)
226 | self.btn_reg = QtWidgets.QPushButton(login)
227 | self.btn_reg.setMaximumSize(QtCore.QSize(100, 40))
228 | font = QtGui.QFont()
229 | font.setFamily("微软雅黑")
230 | font.setPointSize(-1)
231 | self.btn_reg.setFont(font)
232 | self.btn_reg.setStyleSheet("QPushButton\n"
233 | "{\n"
234 | "font-size:16px;\n"
235 | "border-radius:16px;\n"
236 | "border:2px solid green;\n"
237 | "background:white;\n"
238 | "}\n"
239 | "QPushButton:hover \n"
240 | "{\n"
241 | " color:rgb(97, 97, 97)\n"
242 | "}\n"
243 | "QPushButton:pressed \n"
244 | "{\n"
245 | " margin-top: -2px;\n"
246 | " margin-bottom:2px;\n"
247 | " \n"
248 | "}")
249 | icon4 = QtGui.QIcon()
250 | icon4.addPixmap(QtGui.QPixmap(":/resource/icon/用户.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
251 | self.btn_reg.setIcon(icon4)
252 | self.btn_reg.setObjectName("btn_reg")
253 | self.layout_decide.addWidget(self.btn_reg)
254 | self.btn_return = QtWidgets.QPushButton(login)
255 | self.btn_return.setMaximumSize(QtCore.QSize(100, 40))
256 | font = QtGui.QFont()
257 | font.setFamily("微软雅黑")
258 | font.setPointSize(-1)
259 | self.btn_return.setFont(font)
260 | self.btn_return.setStyleSheet("QPushButton{\n"
261 | "font-size:16px;\n"
262 | "border-radius:16px;\n"
263 | "border:2px solid green;\n"
264 | "background:white;\n"
265 | "}\n"
266 | "\n"
267 | "QPushButton:hover \n"
268 | "{\n"
269 | " color:rgb(97, 97, 97)\n"
270 | "}\n"
271 | "QPushButton:pressed \n"
272 | "{\n"
273 | " margin-top: -2px;\n"
274 | " margin-bottom:2px;\n"
275 | " \n"
276 | "}")
277 | icon5 = QtGui.QIcon()
278 | icon5.addPixmap(QtGui.QPixmap(":/resource/icon/返回.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
279 | self.btn_return.setIcon(icon5)
280 | self.btn_return.setObjectName("btn_return")
281 | self.layout_decide.addWidget(self.btn_return)
282 | self.verticalLayout.addLayout(self.layout_decide)
283 | self.verticalLayout.setStretch(0, 2)
284 | self.verticalLayout.setStretch(2, 8)
285 | self.verticalLayout.setStretch(4, 5)
286 | self.verticalLayout.setStretch(5, 2)
287 |
288 | self.retranslateUi(login)
289 | QtCore.QMetaObject.connectSlotsByName(login)
290 |
291 | def retranslateUi(self, login):
292 | _translate = QtCore.QCoreApplication.translate
293 | login.setWindowTitle(_translate("login", "登陆界面"))
294 | self.label_title.setText(_translate("login", ">> 登 陆 <<"))
295 | self.btn_reget.setText(_translate("login", "重新捕获"))
296 | self.btn_get_face.setText(_translate("login", "捕获人脸"))
297 | self.btn_connect.setText(_translate("login", "服务器连接失败!"))
298 | self.btn_decide.setText(_translate("login", "确 认"))
299 | self.btn_reg.setText(_translate("login", "注 册"))
300 | self.btn_return.setText(_translate("login", "返 回"))
301 |
302 |
303 | import ui_file.resource_rc
304 |
--------------------------------------------------------------------------------
/ui_file/ui_login.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | login
4 |
5 |
6 |
7 | 0
8 | 0
9 | 424
10 | 735
11 |
12 |
13 |
14 |
15 | 0
16 | 0
17 |
18 |
19 |
20 | 注册界面
21 |
22 |
23 | false
24 |
25 |
26 | border-image: url(:/resource/img/color.jpg);
27 | QWidget#reg {
28 | border-top-left-radius: 15px;
29 | border-bottom-left-radius: 15px;
30 | border-top-right-radius: 15px;
31 | border-bottom-right-radius: 15px;
32 | border: 2px solid white;
33 | }
34 |
35 |
36 |
37 | 5
38 |
39 |
40 | 5
41 |
42 |
43 | 5
44 |
45 |
46 | 20
47 |
48 | -
49 |
50 |
51 |
52 | Microsoft YaHei
53 | 25
54 | 75
55 | false
56 | true
57 |
58 |
59 |
60 | color:white;
61 | font: 85 25pt "Microsoft YaHei";
62 | font-weight:bold;
63 | border-image:None;
64 |
65 |
66 |
67 |
68 |
69 |
70 | >> 登 陆 <<
71 |
72 |
73 | Qt::AlignCenter
74 |
75 |
76 |
77 | -
78 |
79 |
80 | Qt::Horizontal
81 |
82 |
83 |
84 | -
85 |
86 |
87 | border-image: None;
88 | QWidget#widget_cam {
89 | border: 2px solid white;
90 | border-radius: 40px;
91 | }
92 |
93 |
94 |
95 |
96 | 25
97 |
98 |
99 | 10
100 |
101 |
102 | 25
103 |
104 |
105 | 10
106 |
107 |
-
108 |
109 |
110 | border-radius: 20px;
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 | -
121 |
122 |
123 | Qt::Horizontal
124 |
125 |
126 |
127 | -
128 |
129 |
130 | border-image: None;
131 |
132 |
133 |
134 | 50
135 |
136 |
137 | 1
138 |
139 |
140 | 50
141 |
142 |
143 | 1
144 |
145 |
146 | 2
147 |
148 |
149 | 5
150 |
151 |
-
152 |
153 |
-
154 |
155 |
156 | border-image: url(:/resource/img/Dark_人脸识别.png);
157 |
158 |
159 |
160 |
161 |
162 |
163 | -
164 |
165 |
166 |
167 | 75
168 | 0
169 |
170 |
171 |
172 |
173 | 100
174 | 100
175 |
176 |
177 |
178 |
179 | 微软雅黑
180 | -1
181 | false
182 | false
183 |
184 |
185 |
186 | QPushButton
187 | {
188 | border-radius: 10px;
189 | padding:5px;
190 | text-align: center;
191 | text-decoration: none;
192 | font-size:14px;
193 | margin: 4px 2px;
194 | background-color: white;
195 | color:#1d4181;
196 | border:1px solid #1d4181;
197 | }
198 | QPushButton:hover
199 | {
200 | background-color: #008cba;
201 | color: white;
202 | }
203 | QPushButton:pressed
204 | {
205 | margin-top: -2px;
206 | margin-bottom:2px;
207 |
208 | }
209 |
210 |
211 |
212 | 重新捕获
213 |
214 |
215 |
216 | :/resource/icon/redo.png:/resource/icon/redo.png
217 |
218 |
219 |
220 | -
221 |
222 |
223 |
224 | 75
225 | 0
226 |
227 |
228 |
229 |
230 | 100
231 | 100
232 |
233 |
234 |
235 |
236 | 微软雅黑
237 | -1
238 | false
239 | false
240 |
241 |
242 |
243 | QPushButton
244 | {
245 | border-radius: 10px;
246 | padding:5px;
247 | text-align: center;
248 | text-decoration: none;
249 | font-size:14px;
250 | margin: 4px 2px;
251 | background-color: white;
252 | color:#1d4181;
253 | border:1px solid #1d4181;
254 | }
255 | QPushButton:hover
256 | {
257 | background-color: #008cba;
258 | color: white;
259 | }
260 | QPushButton:pressed
261 | {
262 | margin-top: -2px;
263 | margin-bottom:2px;
264 |
265 | }
266 |
267 |
268 | 捕获人脸
269 |
270 |
271 |
272 | :/resource/icon/人脸识别.png:/resource/icon/人脸识别.png
273 |
274 |
275 |
276 | -
277 |
278 |
279 |
280 | 180
281 | 35
282 |
283 |
284 |
285 | QPushButton
286 | {
287 | border-radius: 10px;
288 | padding:5px;
289 | text-align: center;
290 | text-decoration: none;
291 | font-size:12px;
292 | margin: 4px 2px;
293 | background-color: white;
294 | color:#1d4181;
295 | border:1px solid black;
296 | }
297 |
298 |
299 | 服务器连接失败!
300 |
301 |
302 |
303 | :/resource/icon/提醒,感叹号_jurassic.png:/resource/icon/提醒,感叹号_jurassic.png
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 | -
313 |
314 |
315 | 20
316 |
317 |
318 | 50
319 |
320 |
321 | 50
322 |
323 |
-
324 |
325 |
326 |
327 | 100
328 | 40
329 |
330 |
331 |
332 |
333 | 微软雅黑
334 | -1
335 |
336 |
337 |
338 |
339 | QPushButton
340 | {
341 | font-size:16px;
342 | border-radius:16px;
343 | border:2px solid green;
344 | background:white;
345 | }
346 | QPushButton:hover
347 | {
348 | color:rgb(97, 97, 97)
349 | }
350 | QPushButton:pressed
351 | {
352 | margin-top: -2px;
353 | margin-bottom:2px;
354 |
355 | }
356 |
357 |
358 | 确 认
359 |
360 |
361 |
362 | :/resource/icon/check-circle.png:/resource/icon/check-circle.png
363 |
364 |
365 |
366 | -
367 |
368 |
369 |
370 | 100
371 | 40
372 |
373 |
374 |
375 |
376 | 微软雅黑
377 | -1
378 |
379 |
380 |
381 | QPushButton
382 | {
383 | font-size:16px;
384 | border-radius:16px;
385 | border:2px solid green;
386 | background:white;
387 | }
388 | QPushButton:hover
389 | {
390 | color:rgb(97, 97, 97)
391 | }
392 | QPushButton:pressed
393 | {
394 | margin-top: -2px;
395 | margin-bottom:2px;
396 |
397 | }
398 |
399 |
400 | 注 册
401 |
402 |
403 |
404 | :/resource/icon/用户.png:/resource/icon/用户.png
405 |
406 |
407 |
408 | -
409 |
410 |
411 |
412 | 100
413 | 40
414 |
415 |
416 |
417 |
418 | 微软雅黑
419 | -1
420 |
421 |
422 |
423 | QPushButton{
424 | font-size:16px;
425 | border-radius:16px;
426 | border:2px solid green;
427 | background:white;
428 | }
429 |
430 | QPushButton:hover
431 | {
432 | color:rgb(97, 97, 97)
433 | }
434 | QPushButton:pressed
435 | {
436 | margin-top: -2px;
437 | margin-bottom:2px;
438 |
439 | }
440 |
441 |
442 | 返 回
443 |
444 |
445 |
446 | :/resource/icon/返回.png:/resource/icon/返回.png
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
--------------------------------------------------------------------------------
/ui_file/ui_reg.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Form implementation generated from reading ui file 'ui_reg.ui'
4 | #
5 | # Created by: PyQt5 UI code generator 5.15.4
6 | #
7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is
8 | # run again. Do not edit this file unless you know what you are doing.
9 |
10 |
11 | from PyQt5 import QtCore, QtGui, QtWidgets
12 |
13 |
14 | class Ui_reg(object):
15 | def setupUi(self, reg):
16 | reg.setObjectName("reg")
17 | reg.resize(424, 735)
18 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored)
19 | sizePolicy.setHorizontalStretch(0)
20 | sizePolicy.setVerticalStretch(0)
21 | sizePolicy.setHeightForWidth(reg.sizePolicy().hasHeightForWidth())
22 | reg.setSizePolicy(sizePolicy)
23 | reg.setAutoFillBackground(False)
24 | reg.setStyleSheet("border-image: url(:/resource/img/color.jpg);\n"
25 | "QWidget#reg {\n"
26 | " border-top-left-radius: 15px;\n"
27 | " border-bottom-left-radius: 15px;\n"
28 | " border-top-right-radius: 15px;\n"
29 | " border-bottom-right-radius: 15px;\n"
30 | " border: 2px solid white; \n"
31 | "}")
32 | self.verticalLayout = QtWidgets.QVBoxLayout(reg)
33 | self.verticalLayout.setContentsMargins(5, 5, 5, 20)
34 | self.verticalLayout.setObjectName("verticalLayout")
35 | self.label_title = QtWidgets.QLabel(reg)
36 | font = QtGui.QFont()
37 | font.setFamily("Microsoft YaHei")
38 | font.setPointSize(25)
39 | font.setBold(True)
40 | font.setItalic(False)
41 | font.setWeight(75)
42 | self.label_title.setFont(font)
43 | self.label_title.setStyleSheet("color:white;\n"
44 | "font: 85 25pt \"Microsoft YaHei\";\n"
45 | "font-weight:bold;\n"
46 | "border-image:None;\n"
47 | "\n"
48 | "\n"
49 | "\n"
50 | "")
51 | self.label_title.setAlignment(QtCore.Qt.AlignCenter)
52 | self.label_title.setObjectName("label_title")
53 | self.verticalLayout.addWidget(self.label_title)
54 | self.line_2 = QtWidgets.QFrame(reg)
55 | self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
56 | self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
57 | self.line_2.setObjectName("line_2")
58 | self.verticalLayout.addWidget(self.line_2)
59 | self.widget_cam = QtWidgets.QWidget(reg)
60 | self.widget_cam.setStyleSheet("border-image: None;\n"
61 | "QWidget#widget_cam {\n"
62 | " border: 2px solid white;\n"
63 | " border-radius: 40px;\n"
64 | "}\n"
65 | "")
66 | self.widget_cam.setObjectName("widget_cam")
67 | self.gridLayout_2 = QtWidgets.QGridLayout(self.widget_cam)
68 | self.gridLayout_2.setContentsMargins(25, 10, 25, 10)
69 | self.gridLayout_2.setObjectName("gridLayout_2")
70 | self.label_cam = QtWidgets.QLabel(self.widget_cam)
71 | self.label_cam.setStyleSheet("border-radius: 20px;")
72 | self.label_cam.setText("")
73 | self.label_cam.setObjectName("label_cam")
74 | self.gridLayout_2.addWidget(self.label_cam, 0, 0, 1, 1)
75 | self.verticalLayout.addWidget(self.widget_cam)
76 | self.line = QtWidgets.QFrame(reg)
77 | self.line.setFrameShape(QtWidgets.QFrame.HLine)
78 | self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
79 | self.line.setObjectName("line")
80 | self.verticalLayout.addWidget(self.line)
81 | self.widget_input = QtWidgets.QWidget(reg)
82 | self.widget_input.setStyleSheet("border-image: None;")
83 | self.widget_input.setObjectName("widget_input")
84 | self.gridLayout = QtWidgets.QGridLayout(self.widget_input)
85 | self.gridLayout.setContentsMargins(50, 0, 50, 1)
86 | self.gridLayout.setHorizontalSpacing(2)
87 | self.gridLayout.setVerticalSpacing(4)
88 | self.gridLayout.setObjectName("gridLayout")
89 | self.label_5 = QtWidgets.QLabel(self.widget_input)
90 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
91 | sizePolicy.setHorizontalStretch(25)
92 | sizePolicy.setVerticalStretch(25)
93 | sizePolicy.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth())
94 | self.label_5.setSizePolicy(sizePolicy)
95 | self.label_5.setMinimumSize(QtCore.QSize(25, 25))
96 | self.label_5.setMaximumSize(QtCore.QSize(50, 20))
97 | self.label_5.setStyleSheet("border-image: url(:/resource/icon/时间.png);")
98 | self.label_5.setText("")
99 | self.label_5.setObjectName("label_5")
100 | self.gridLayout.addWidget(self.label_5, 2, 0, 1, 1)
101 | self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
102 | self.horizontalLayout_4.setSpacing(15)
103 | self.horizontalLayout_4.setObjectName("horizontalLayout_4")
104 | self.btn_get_face = QtWidgets.QPushButton(self.widget_input)
105 | self.btn_get_face.setMinimumSize(QtCore.QSize(75, 0))
106 | self.btn_get_face.setMaximumSize(QtCore.QSize(100, 100))
107 | font = QtGui.QFont()
108 | font.setFamily("微软雅黑")
109 | font.setPointSize(-1)
110 | font.setUnderline(False)
111 | font.setStrikeOut(False)
112 | self.btn_get_face.setFont(font)
113 | self.btn_get_face.setStyleSheet("QPushButton\n"
114 | "{\n"
115 | " border-radius: 10px;\n"
116 | " padding:5px;\n"
117 | " text-align: center;\n"
118 | " text-decoration: none;\n"
119 | " font-size:14px;\n"
120 | " margin: 4px 2px;\n"
121 | " background-color: white;\n"
122 | " color:#1d4181;\n"
123 | " border:1px solid #1d4181;\n"
124 | "}\n"
125 | "QPushButton:hover \n"
126 | "{\n"
127 | " background-color: #008cba;\n"
128 | " color: white;\n"
129 | "}\n"
130 | "QPushButton:pressed \n"
131 | "{\n"
132 | " margin-top: -2px;\n"
133 | " margin-bottom:2px;\n"
134 | " \n"
135 | "}")
136 | self.btn_get_face.setObjectName("btn_get_face")
137 | self.horizontalLayout_4.addWidget(self.btn_get_face)
138 | self.btn_reget = QtWidgets.QPushButton(self.widget_input)
139 | self.btn_reget.setMinimumSize(QtCore.QSize(75, 0))
140 | self.btn_reget.setMaximumSize(QtCore.QSize(100, 100))
141 | font = QtGui.QFont()
142 | font.setFamily("微软雅黑")
143 | font.setPointSize(-1)
144 | font.setUnderline(False)
145 | font.setStrikeOut(False)
146 | self.btn_reget.setFont(font)
147 | self.btn_reget.setStyleSheet("QPushButton\n"
148 | "{\n"
149 | " border-radius: 10px;\n"
150 | " padding:5px;\n"
151 | " text-align: center;\n"
152 | " text-decoration: none;\n"
153 | " font-size:14px;\n"
154 | " margin: 4px 2px;\n"
155 | " background-color: white;\n"
156 | " color:#1d4181;\n"
157 | " border:1px solid #1d4181;\n"
158 | "}\n"
159 | "QPushButton:hover \n"
160 | "{\n"
161 | " background-color: #008cba;\n"
162 | " color: white;\n"
163 | "}\n"
164 | "QPushButton:pressed \n"
165 | "{\n"
166 | " margin-top: -2px;\n"
167 | " margin-bottom:2px;\n"
168 | " \n"
169 | "}\n"
170 | "")
171 | self.btn_reget.setObjectName("btn_reget")
172 | self.horizontalLayout_4.addWidget(self.btn_reget)
173 | self.gridLayout.addLayout(self.horizontalLayout_4, 3, 2, 1, 3)
174 | self.label_6 = QtWidgets.QLabel(self.widget_input)
175 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
176 | sizePolicy.setHorizontalStretch(25)
177 | sizePolicy.setVerticalStretch(25)
178 | sizePolicy.setHeightForWidth(self.label_6.sizePolicy().hasHeightForWidth())
179 | self.label_6.setSizePolicy(sizePolicy)
180 | self.label_6.setMinimumSize(QtCore.QSize(25, 25))
181 | self.label_6.setMaximumSize(QtCore.QSize(50, 20))
182 | self.label_6.setStyleSheet("border-image: url(:/resource/icon/人脸识别.png);")
183 | self.label_6.setText("")
184 | self.label_6.setObjectName("label_6")
185 | self.gridLayout.addWidget(self.label_6, 3, 0, 1, 1)
186 | self.label_2 = QtWidgets.QLabel(self.widget_input)
187 | font = QtGui.QFont()
188 | font.setFamily("微软雅黑")
189 | font.setPointSize(11)
190 | self.label_2.setFont(font)
191 | self.label_2.setAlignment(QtCore.Qt.AlignCenter)
192 | self.label_2.setObjectName("label_2")
193 | self.gridLayout.addWidget(self.label_2, 2, 1, 1, 1)
194 | self.label = QtWidgets.QLabel(self.widget_input)
195 | font = QtGui.QFont()
196 | font.setFamily("微软雅黑")
197 | font.setPointSize(11)
198 | self.label.setFont(font)
199 | self.label.setAlignment(QtCore.Qt.AlignCenter)
200 | self.label.setObjectName("label")
201 | self.gridLayout.addWidget(self.label, 1, 1, 1, 1)
202 | self.label_3 = QtWidgets.QLabel(self.widget_input)
203 | font = QtGui.QFont()
204 | font.setFamily("微软雅黑")
205 | font.setPointSize(11)
206 | self.label_3.setFont(font)
207 | self.label_3.setAlignment(QtCore.Qt.AlignCenter)
208 | self.label_3.setObjectName("label_3")
209 | self.gridLayout.addWidget(self.label_3, 3, 1, 1, 1)
210 | self.edit_time = QtWidgets.QLineEdit(self.widget_input)
211 | self.edit_time.setMinimumSize(QtCore.QSize(75, 0))
212 | self.edit_time.setMaximumSize(QtCore.QSize(500, 500))
213 | self.edit_time.setStyleSheet("background: transparent;\n"
214 | "color:rgb(0, 0, 0);\n"
215 | "border-width:1px;border-style:none none solid none;border-color:black;\n"
216 | "width:100%;\n"
217 | "font-size:14px;\n"
218 | "height:20px;\n"
219 | "line-height:25px;\n"
220 | "padding:4px;\n"
221 | "")
222 | self.edit_time.setAlignment(QtCore.Qt.AlignCenter)
223 | self.edit_time.setReadOnly(True)
224 | self.edit_time.setObjectName("edit_time")
225 | self.gridLayout.addWidget(self.edit_time, 2, 2, 1, 3)
226 | self.label_4 = QtWidgets.QLabel(self.widget_input)
227 | self.label_4.setMinimumSize(QtCore.QSize(25, 25))
228 | self.label_4.setMaximumSize(QtCore.QSize(25, 25))
229 | self.label_4.setStyleSheet("border-image: url(:/resource/icon/用户.png);")
230 | self.label_4.setText("")
231 | self.label_4.setObjectName("label_4")
232 | self.gridLayout.addWidget(self.label_4, 1, 0, 1, 1)
233 | self.edit_user_name = QtWidgets.QLineEdit(self.widget_input)
234 | self.edit_user_name.setMinimumSize(QtCore.QSize(75, 0))
235 | self.edit_user_name.setMaximumSize(QtCore.QSize(500, 500))
236 | self.edit_user_name.setStyleSheet("border:1px solid black; \n"
237 | "width:100%;\n"
238 | "font-size:14px;\n"
239 | "height:20px;\n"
240 | "line-height:24px;\n"
241 | "padding:5px;")
242 | self.edit_user_name.setText("")
243 | self.edit_user_name.setMaxLength(10)
244 | self.edit_user_name.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
245 | self.edit_user_name.setClearButtonEnabled(True)
246 | self.edit_user_name.setObjectName("edit_user_name")
247 | self.gridLayout.addWidget(self.edit_user_name, 1, 2, 1, 3)
248 | self.pushButton = QtWidgets.QPushButton(self.widget_input)
249 | self.pushButton.setMaximumSize(QtCore.QSize(180, 35))
250 | self.pushButton.setStyleSheet("QPushButton\n"
251 | "{\n"
252 | " border-radius: 10px;\n"
253 | " padding:5px;\n"
254 | " text-align: center;\n"
255 | " text-decoration: none;\n"
256 | " font-size:12px;\n"
257 | " margin: 4px 2px;\n"
258 | " background-color: white;\n"
259 | " color:#1d4181;\n"
260 | " border:1px solid black;\n"
261 | "}")
262 | icon = QtGui.QIcon()
263 | icon.addPixmap(QtGui.QPixmap(":/resource/icon/提醒,感叹号_jurassic.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
264 | self.pushButton.setIcon(icon)
265 | self.pushButton.setObjectName("pushButton")
266 | self.gridLayout.addWidget(self.pushButton, 0, 2, 1, 2)
267 | self.verticalLayout.addWidget(self.widget_input)
268 | self.layout_decide = QtWidgets.QHBoxLayout()
269 | self.layout_decide.setContentsMargins(50, -1, 50, -1)
270 | self.layout_decide.setSpacing(20)
271 | self.layout_decide.setObjectName("layout_decide")
272 | self.btn_decide = QtWidgets.QPushButton(reg)
273 | self.btn_decide.setMaximumSize(QtCore.QSize(100, 40))
274 | font = QtGui.QFont()
275 | font.setFamily("微软雅黑")
276 | font.setPointSize(-1)
277 | self.btn_decide.setFont(font)
278 | self.btn_decide.setStyleSheet("\n"
279 | "QPushButton\n"
280 | "{\n"
281 | "font-size:16px;\n"
282 | "border-radius:16px;\n"
283 | "border:2px solid green;\n"
284 | "background:white;\n"
285 | "}\n"
286 | "QPushButton:hover \n"
287 | "{\n"
288 | " color:rgb(97, 97, 97)\n"
289 | "}\n"
290 | "QPushButton:pressed \n"
291 | "{\n"
292 | " margin-top: -2px;\n"
293 | " margin-bottom:2px;\n"
294 | " \n"
295 | "}")
296 | icon1 = QtGui.QIcon()
297 | icon1.addPixmap(QtGui.QPixmap(":/resource/icon/check-circle.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
298 | self.btn_decide.setIcon(icon1)
299 | self.btn_decide.setObjectName("btn_decide")
300 | self.layout_decide.addWidget(self.btn_decide)
301 | self.btn_return = QtWidgets.QPushButton(reg)
302 | self.btn_return.setMaximumSize(QtCore.QSize(100, 40))
303 | font = QtGui.QFont()
304 | font.setFamily("微软雅黑")
305 | font.setPointSize(-1)
306 | self.btn_return.setFont(font)
307 | self.btn_return.setStyleSheet("QPushButton{\n"
308 | "font-size:16px;\n"
309 | "border-radius:16px;\n"
310 | "border:2px solid green;\n"
311 | "background:white;\n"
312 | "}\n"
313 | "\n"
314 | "QPushButton:hover \n"
315 | "{\n"
316 | " color:rgb(97, 97, 97)\n"
317 | "}\n"
318 | "QPushButton:pressed \n"
319 | "{\n"
320 | " margin-top: -2px;\n"
321 | " margin-bottom:2px;\n"
322 | " \n"
323 | "}")
324 | icon2 = QtGui.QIcon()
325 | icon2.addPixmap(QtGui.QPixmap(":/resource/icon/返回.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
326 | self.btn_return.setIcon(icon2)
327 | self.btn_return.setObjectName("btn_return")
328 | self.layout_decide.addWidget(self.btn_return)
329 | self.verticalLayout.addLayout(self.layout_decide)
330 | self.verticalLayout.setStretch(0, 2)
331 | self.verticalLayout.setStretch(2, 8)
332 | self.verticalLayout.setStretch(4, 5)
333 | self.verticalLayout.setStretch(5, 2)
334 |
335 | self.retranslateUi(reg)
336 | QtCore.QMetaObject.connectSlotsByName(reg)
337 |
338 | def retranslateUi(self, reg):
339 | _translate = QtCore.QCoreApplication.translate
340 | reg.setWindowTitle(_translate("reg", "注册界面"))
341 | self.label_title.setText(_translate("reg", ">> 注 册 <<"))
342 | self.btn_get_face.setText(_translate("reg", "捕获人脸"))
343 | self.btn_reget.setText(_translate("reg", "重新捕获"))
344 | self.label_2.setText(_translate("reg", "时间:"))
345 | self.label.setText(_translate("reg", "名称:"))
346 | self.label_3.setText(_translate("reg", "识别:"))
347 | self.edit_user_name.setPlaceholderText(_translate("reg", " 请输入用户名称"))
348 | self.pushButton.setText(_translate("reg", "服务器连接失败"))
349 | self.btn_decide.setText(_translate("reg", "确 认"))
350 | self.btn_return.setText(_translate("reg", "返 回"))
351 |
352 |
353 | import ui_file.resource_rc
354 |
--------------------------------------------------------------------------------
/ui_file/ui_reg.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | reg
4 |
5 |
6 |
7 | 0
8 | 0
9 | 424
10 | 735
11 |
12 |
13 |
14 |
15 | 0
16 | 0
17 |
18 |
19 |
20 | 注册界面
21 |
22 |
23 | false
24 |
25 |
26 | border-image: url(:/resource/img/color.jpg);
27 | QWidget#reg {
28 | border-top-left-radius: 15px;
29 | border-bottom-left-radius: 15px;
30 | border-top-right-radius: 15px;
31 | border-bottom-right-radius: 15px;
32 | border: 2px solid white;
33 | }
34 |
35 |
36 |
37 | 5
38 |
39 |
40 | 5
41 |
42 |
43 | 5
44 |
45 |
46 | 20
47 |
48 | -
49 |
50 |
51 |
52 | Microsoft YaHei
53 | 25
54 | 75
55 | false
56 | true
57 |
58 |
59 |
60 | color:white;
61 | font: 85 25pt "Microsoft YaHei";
62 | font-weight:bold;
63 | border-image:None;
64 |
65 |
66 |
67 |
68 |
69 |
70 | >> 注 册 <<
71 |
72 |
73 | Qt::AlignCenter
74 |
75 |
76 |
77 | -
78 |
79 |
80 | Qt::Horizontal
81 |
82 |
83 |
84 | -
85 |
86 |
87 | border-image: None;
88 | QWidget#widget_cam {
89 | border: 2px solid white;
90 | border-radius: 40px;
91 | }
92 |
93 |
94 |
95 |
96 | 25
97 |
98 |
99 | 10
100 |
101 |
102 | 25
103 |
104 |
105 | 10
106 |
107 |
-
108 |
109 |
110 | border-radius: 20px;
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 | -
121 |
122 |
123 | Qt::Horizontal
124 |
125 |
126 |
127 | -
128 |
129 |
130 | border-image: None;
131 |
132 |
133 |
134 | 50
135 |
136 |
137 | 0
138 |
139 |
140 | 50
141 |
142 |
143 | 1
144 |
145 |
146 | 2
147 |
148 |
149 | 4
150 |
151 |
-
152 |
153 |
154 |
155 | 25
156 | 25
157 |
158 |
159 |
160 |
161 | 25
162 | 25
163 |
164 |
165 |
166 |
167 | 50
168 | 20
169 |
170 |
171 |
172 | border-image: url(:/resource/icon/时间.png);
173 |
174 |
175 |
176 |
177 |
178 |
179 | -
180 |
181 |
182 | 15
183 |
184 |
-
185 |
186 |
187 |
188 | 75
189 | 0
190 |
191 |
192 |
193 |
194 | 100
195 | 100
196 |
197 |
198 |
199 |
200 | 微软雅黑
201 | -1
202 | false
203 | false
204 |
205 |
206 |
207 | QPushButton
208 | {
209 | border-radius: 10px;
210 | padding:5px;
211 | text-align: center;
212 | text-decoration: none;
213 | font-size:14px;
214 | margin: 4px 2px;
215 | background-color: white;
216 | color:#1d4181;
217 | border:1px solid #1d4181;
218 | }
219 | QPushButton:hover
220 | {
221 | background-color: #008cba;
222 | color: white;
223 | }
224 | QPushButton:pressed
225 | {
226 | margin-top: -2px;
227 | margin-bottom:2px;
228 |
229 | }
230 |
231 |
232 | 捕获人脸
233 |
234 |
235 |
236 | -
237 |
238 |
239 |
240 | 75
241 | 0
242 |
243 |
244 |
245 |
246 | 100
247 | 100
248 |
249 |
250 |
251 |
252 | 微软雅黑
253 | -1
254 | false
255 | false
256 |
257 |
258 |
259 | QPushButton
260 | {
261 | border-radius: 10px;
262 | padding:5px;
263 | text-align: center;
264 | text-decoration: none;
265 | font-size:14px;
266 | margin: 4px 2px;
267 | background-color: white;
268 | color:#1d4181;
269 | border:1px solid #1d4181;
270 | }
271 | QPushButton:hover
272 | {
273 | background-color: #008cba;
274 | color: white;
275 | }
276 | QPushButton:pressed
277 | {
278 | margin-top: -2px;
279 | margin-bottom:2px;
280 |
281 | }
282 |
283 |
284 |
285 | 重新捕获
286 |
287 |
288 |
289 |
290 |
291 | -
292 |
293 |
294 |
295 | 25
296 | 25
297 |
298 |
299 |
300 |
301 | 25
302 | 25
303 |
304 |
305 |
306 |
307 | 50
308 | 20
309 |
310 |
311 |
312 | border-image: url(:/resource/icon/人脸识别.png);
313 |
314 |
315 |
316 |
317 |
318 |
319 | -
320 |
321 |
322 |
323 | 微软雅黑
324 | 11
325 |
326 |
327 |
328 | 时间:
329 |
330 |
331 | Qt::AlignCenter
332 |
333 |
334 |
335 | -
336 |
337 |
338 |
339 | 微软雅黑
340 | 11
341 |
342 |
343 |
344 | 名称:
345 |
346 |
347 | Qt::AlignCenter
348 |
349 |
350 |
351 | -
352 |
353 |
354 |
355 | 微软雅黑
356 | 11
357 |
358 |
359 |
360 | 识别:
361 |
362 |
363 | Qt::AlignCenter
364 |
365 |
366 |
367 | -
368 |
369 |
370 |
371 | 75
372 | 0
373 |
374 |
375 |
376 |
377 | 500
378 | 500
379 |
380 |
381 |
382 | background: transparent;
383 | color:rgb(0, 0, 0);
384 | border-width:1px;border-style:none none solid none;border-color:black;
385 | width:100%;
386 | font-size:14px;
387 | height:20px;
388 | line-height:25px;
389 | padding:4px;
390 |
391 |
392 |
393 | Qt::AlignCenter
394 |
395 |
396 | true
397 |
398 |
399 |
400 | -
401 |
402 |
403 |
404 | 25
405 | 25
406 |
407 |
408 |
409 |
410 | 25
411 | 25
412 |
413 |
414 |
415 | border-image: url(:/resource/icon/用户.png);
416 |
417 |
418 |
419 |
420 |
421 |
422 | -
423 |
424 |
425 |
426 | 75
427 | 0
428 |
429 |
430 |
431 |
432 | 500
433 | 500
434 |
435 |
436 |
437 | border:1px solid black;
438 | width:100%;
439 | font-size:14px;
440 | height:20px;
441 | line-height:24px;
442 | padding:5px;
443 |
444 |
445 |
446 |
447 |
448 | 10
449 |
450 |
451 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
452 |
453 |
454 | 请输入用户名称
455 |
456 |
457 | true
458 |
459 |
460 |
461 | -
462 |
463 |
464 |
465 | 180
466 | 35
467 |
468 |
469 |
470 | QPushButton
471 | {
472 | border-radius: 10px;
473 | padding:5px;
474 | text-align: center;
475 | text-decoration: none;
476 | font-size:12px;
477 | margin: 4px 2px;
478 | background-color: white;
479 | color:#1d4181;
480 | border:1px solid black;
481 | }
482 |
483 |
484 | 服务器连接失败
485 |
486 |
487 |
488 | :/resource/icon/提醒,感叹号_jurassic.png:/resource/icon/提醒,感叹号_jurassic.png
489 |
490 |
491 |
492 |
493 |
494 |
495 | -
496 |
497 |
498 | 20
499 |
500 |
501 | 50
502 |
503 |
504 | 50
505 |
506 |
-
507 |
508 |
509 |
510 | 100
511 | 40
512 |
513 |
514 |
515 |
516 | 微软雅黑
517 | -1
518 |
519 |
520 |
521 |
522 | QPushButton
523 | {
524 | font-size:16px;
525 | border-radius:16px;
526 | border:2px solid green;
527 | background:white;
528 | }
529 | QPushButton:hover
530 | {
531 | color:rgb(97, 97, 97)
532 | }
533 | QPushButton:pressed
534 | {
535 | margin-top: -2px;
536 | margin-bottom:2px;
537 |
538 | }
539 |
540 |
541 | 确 认
542 |
543 |
544 |
545 | :/resource/icon/check-circle.png:/resource/icon/check-circle.png
546 |
547 |
548 |
549 | -
550 |
551 |
552 |
553 | 100
554 | 40
555 |
556 |
557 |
558 |
559 | 微软雅黑
560 | -1
561 |
562 |
563 |
564 | QPushButton{
565 | font-size:16px;
566 | border-radius:16px;
567 | border:2px solid green;
568 | background:white;
569 | }
570 |
571 | QPushButton:hover
572 | {
573 | color:rgb(97, 97, 97)
574 | }
575 | QPushButton:pressed
576 | {
577 | margin-top: -2px;
578 | margin-bottom:2px;
579 |
580 | }
581 |
582 |
583 | 返 回
584 |
585 |
586 |
587 | :/resource/icon/返回.png:/resource/icon/返回.png
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 |
--------------------------------------------------------------------------------
/ui_file/ui_start.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Form implementation generated from reading ui file 'ui_start.ui'
4 | #
5 | # Created by: PyQt5 UI code generator 5.15.4
6 | #
7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is
8 | # run again. Do not edit this file unless you know what you are doing.
9 |
10 |
11 | from PyQt5 import QtCore, QtGui, QtWidgets
12 |
13 |
14 | class Ui_start(object):
15 | def setupUi(self, start):
16 | start.setObjectName("start")
17 | start.setEnabled(True)
18 | start.resize(822, 593)
19 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored)
20 | sizePolicy.setHorizontalStretch(0)
21 | sizePolicy.setVerticalStretch(0)
22 | sizePolicy.setHeightForWidth(start.sizePolicy().hasHeightForWidth())
23 | start.setSizePolicy(sizePolicy)
24 | icon = QtGui.QIcon()
25 | icon.addPixmap(QtGui.QPixmap(":/resource/icon/resource/icon/人脸核身.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
26 | start.setWindowIcon(icon)
27 | start.setAutoFillBackground(False)
28 | start.setStyleSheet("border-image: url(:/resource/img/main.jpg);")
29 | self.btn_face_reg = QtWidgets.QPushButton(start)
30 | self.btn_face_reg.setGeometry(QtCore.QRect(540, 270, 151, 41))
31 | font = QtGui.QFont()
32 | font.setFamily("黑体")
33 | font.setPointSize(15)
34 | self.btn_face_reg.setFont(font)
35 | self.btn_face_reg.setStyleSheet("QPushButton{\n"
36 | "background:white;\n"
37 | "border-radius:10px;\n"
38 | "border: 1px solid;\n"
39 | "border-image: white;\n"
40 | "}\n"
41 | "\n"
42 | "QPushButton:pressed\n"
43 | "{\n"
44 | " background-color: rgb(0, 85, 255);\n"
45 | " border-style: inset;\n"
46 | " margin-top: -10px;\n"
47 | " margin-bottom: -10px;\n"
48 | "}\n"
49 | "\n"
50 | "QPushButton:hover\n"
51 | "{\n"
52 | "background-color: rgb(0, 255, 255);\n"
53 | "}")
54 | icon1 = QtGui.QIcon()
55 | icon1.addPixmap(QtGui.QPixmap(":/resource/icon/爸爸.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
56 | self.btn_face_reg.setIcon(icon1)
57 | self.btn_face_reg.setObjectName("btn_face_reg")
58 | self.btn_face_recognition = QtWidgets.QPushButton(start)
59 | self.btn_face_recognition.setGeometry(QtCore.QRect(540, 330, 151, 41))
60 | font = QtGui.QFont()
61 | font.setFamily("黑体")
62 | font.setPointSize(15)
63 | self.btn_face_recognition.setFont(font)
64 | self.btn_face_recognition.setStyleSheet("QPushButton{\n"
65 | "background:white;\n"
66 | "border-radius:10px;\n"
67 | "border: 1px solid;\n"
68 | "border-image: white;\n"
69 | "}\n"
70 | "\n"
71 | "QPushButton:pressed\n"
72 | "{\n"
73 | " background-color: rgb(0, 85, 255);\n"
74 | " border-style: inset;\n"
75 | " margin-top: -10px;\n"
76 | " margin-bottom: -10px;\n"
77 | "}\n"
78 | "\n"
79 | "QPushButton:hover\n"
80 | "{\n"
81 | "background-color: rgb(0, 255, 255);\n"
82 | "}")
83 | icon2 = QtGui.QIcon()
84 | icon2.addPixmap(QtGui.QPixmap(":/resource/icon/人脸核身.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
85 | self.btn_face_recognition.setIcon(icon2)
86 | self.btn_face_recognition.setObjectName("btn_face_recognition")
87 | self.btn_exit = QtWidgets.QPushButton(start)
88 | self.btn_exit.setGeometry(QtCore.QRect(540, 390, 151, 41))
89 | font = QtGui.QFont()
90 | font.setFamily("黑体")
91 | font.setPointSize(15)
92 | self.btn_exit.setFont(font)
93 | self.btn_exit.setStyleSheet("QPushButton{\n"
94 | "background:white;\n"
95 | "border-radius:10px;\n"
96 | "border: 1px solid;\n"
97 | "border-image: white;\n"
98 | "}\n"
99 | "\n"
100 | "QPushButton:pressed\n"
101 | "{\n"
102 | " background-color: rgb(0, 85, 255);\n"
103 | " border-style: inset;\n"
104 | " margin-top: -10px;\n"
105 | " margin-bottom: -10px;\n"
106 | "}\n"
107 | "\n"
108 | "QPushButton:hover\n"
109 | "{\n"
110 | "background-color: rgb(0, 255, 255);\n"
111 | "}")
112 | icon3 = QtGui.QIcon()
113 | icon3.addPixmap(QtGui.QPixmap(":/resource/icon/拉钩.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
114 | self.btn_exit.setIcon(icon3)
115 | self.btn_exit.setObjectName("btn_exit")
116 | self.label = QtWidgets.QLabel(start)
117 | self.label.setGeometry(QtCore.QRect(510, 210, 211, 51))
118 | self.label.setStyleSheet("font-family: \"Microsoft YaHei\";\n"
119 | "font-size: 25px;\n"
120 | "font-style: italic;\n"
121 | "font-weight: bold;\n"
122 | "color: white;\n"
123 | "font: bold italic 25px \"Microsoft YaHei\";\n"
124 | "border-image: url(:/resource/img/resource/img/reg.jpg);\n"
125 | "border-image: white;\n"
126 | "\n"
127 | "\n"
128 | "\n"
129 | "")
130 | self.label.setObjectName("label")
131 |
132 | self.retranslateUi(start)
133 | QtCore.QMetaObject.connectSlotsByName(start)
134 |
135 | def retranslateUi(self, start):
136 | _translate = QtCore.QCoreApplication.translate
137 | start.setWindowTitle(_translate("start", "智能校园防护系统主界面"))
138 | self.btn_face_reg.setText(_translate("start", "人脸注册"))
139 | self.btn_face_recognition.setText(_translate("start", "开启识别"))
140 | self.btn_exit.setText(_translate("start", "退出程序"))
141 | self.label.setText(_translate("start", "智能校园防御系统"))
142 |
143 |
144 | import ui_file.resource_rc
145 |
--------------------------------------------------------------------------------
/ui_file/ui_start.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | start
4 |
5 |
6 | true
7 |
8 |
9 |
10 | 0
11 | 0
12 | 822
13 | 593
14 |
15 |
16 |
17 |
18 | 0
19 | 0
20 |
21 |
22 |
23 | 智能校园防护系统主界面
24 |
25 |
26 |
27 | :/resource/icon/resource/icon/人脸核身.png:/resource/icon/resource/icon/人脸核身.png
28 |
29 |
30 | false
31 |
32 |
33 | border-image: url(:/resource/img/main.jpg);
34 |
35 |
36 |
37 |
38 | 540
39 | 270
40 | 151
41 | 41
42 |
43 |
44 |
45 |
46 | 黑体
47 | 15
48 |
49 |
50 |
51 | QPushButton{
52 | background:white;
53 | border-radius:10px;
54 | border: 1px solid;
55 | border-image: white;
56 | }
57 |
58 | QPushButton:pressed
59 | {
60 | background-color: rgb(0, 85, 255);
61 | border-style: inset;
62 | margin-top: -10px;
63 | margin-bottom: -10px;
64 | }
65 |
66 | QPushButton:hover
67 | {
68 | background-color: rgb(0, 255, 255);
69 | }
70 |
71 |
72 | 人脸注册
73 |
74 |
75 |
76 | :/resource/icon/爸爸.png:/resource/icon/爸爸.png
77 |
78 |
79 |
80 |
81 |
82 | 540
83 | 330
84 | 151
85 | 41
86 |
87 |
88 |
89 |
90 | 黑体
91 | 15
92 |
93 |
94 |
95 | QPushButton{
96 | background:white;
97 | border-radius:10px;
98 | border: 1px solid;
99 | border-image: white;
100 | }
101 |
102 | QPushButton:pressed
103 | {
104 | background-color: rgb(0, 85, 255);
105 | border-style: inset;
106 | margin-top: -10px;
107 | margin-bottom: -10px;
108 | }
109 |
110 | QPushButton:hover
111 | {
112 | background-color: rgb(0, 255, 255);
113 | }
114 |
115 |
116 | 开启识别
117 |
118 |
119 |
120 | :/resource/icon/人脸核身.png:/resource/icon/人脸核身.png
121 |
122 |
123 |
124 |
125 |
126 | 540
127 | 390
128 | 151
129 | 41
130 |
131 |
132 |
133 |
134 | 黑体
135 | 15
136 |
137 |
138 |
139 | QPushButton{
140 | background:white;
141 | border-radius:10px;
142 | border: 1px solid;
143 | border-image: white;
144 | }
145 |
146 | QPushButton:pressed
147 | {
148 | background-color: rgb(0, 85, 255);
149 | border-style: inset;
150 | margin-top: -10px;
151 | margin-bottom: -10px;
152 | }
153 |
154 | QPushButton:hover
155 | {
156 | background-color: rgb(0, 255, 255);
157 | }
158 |
159 |
160 | 退出程序
161 |
162 |
163 |
164 | :/resource/icon/拉钩.png:/resource/icon/拉钩.png
165 |
166 |
167 |
168 |
169 |
170 | 510
171 | 210
172 | 211
173 | 51
174 |
175 |
176 |
177 | font-family: "Microsoft YaHei";
178 | font-size: 25px;
179 | font-style: italic;
180 | font-weight: bold;
181 | color: white;
182 | font: bold italic 25px "Microsoft YaHei";
183 | border-image: url(:/resource/img/resource/img/reg.jpg);
184 | border-image: white;
185 |
186 |
187 |
188 |
189 |
190 |
191 | 智能校园防御系统
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
--------------------------------------------------------------------------------
/win/CLoginWin.py:
--------------------------------------------------------------------------------
1 | import time
2 |
3 | from ui_file.ui_login import *
4 | from win.CRegWin import CRegWin
5 | from win.CMainWin import *
6 | from CNetWork import *
7 |
8 |
9 | class CLoginWin(QWidget, Ui_login):
10 | """登陆窗口"""
11 | _startPos = None
12 | _endPos = None
13 | _isTracking = False
14 |
15 | def __init__(self, mask_check, parent=None):
16 | """
17 | 登陆窗口初始化
18 | :param mask_check: mask识别类函数
19 | :param parent: 父窗口
20 | """
21 | super(CLoginWin, self).__init__() # super() 函数是用于调用父类(超类)的一个方法。
22 | self.setupUi(self)
23 | self.__parent = parent
24 | self.output_res = []
25 |
26 | # 实例化相关类
27 | self.win_opt = CWinOpt()
28 | self.ai_face = CAiFaceDetection()
29 | self.mask_check = mask_check
30 | self.Cam_Opt = CCamOpt("./temp/", 0, self.win_opt, self.ai_face, self.mask_check)
31 | self.network = CNetWork()
32 | # 界面设置
33 | self.win_opt.drawn(BACKGROUND_PATH, self)
34 | self.setWindowFlags(Qt.FramelessWindowHint) # 无边框
35 |
36 | # 槽函数相关连接
37 | self.btn_get_face.clicked.connect(self.SlotGetFace) # 捕获人脸按钮
38 | self.btn_reget.clicked.connect(self.SlotReGet) # 重新捕获按钮
39 | self.btn_reg.clicked.connect(self.SlotToReg) # 跳转到注册界面
40 | self.btn_return.clicked.connect(self.SlotReturn) # 跳转到上级菜单
41 | self.btn_decide.clicked.connect(self.SlotDecide) # 确定发送图片信息
42 |
43 | # 判断连接的定时器
44 | self.timer = QTimer()
45 | self.timer.start(2 * 1000)
46 | #self.timer.timeout.connect(self.BtnConnectInfo)
47 |
48 | # 启动摄像头
49 | # ThreadOptShowVideo(self, file_name, label, ai_switch=True, class_mode=False):
50 | self.Cam_Opt.ThreadOptShowVideo('', self.label_cam, False, False)
51 |
52 | # # 发起连接
53 | # self.StartConnect()
54 |
55 | # 点击确定连接
56 | def SlotDecide(self):
57 | """
58 | 点击确定按钮
59 | :return:
60 | """
61 | # 调用百度AI接口, 进行人脸判断
62 | if len(self.output_res) == 0:
63 | self.win_opt.OneBtnMsgBox("提示", "您未捕获人脸", QMessageBox.Information)
64 | else:
65 | res = self.ai_face.FaceLogin(self.output_res[0], "safeGuard")
66 | if len(res) == 0:
67 | self.win_opt.OneBtnMsgBox("警告", "人脸登录识别失败", QMessageBox.Critical)
68 | else:
69 | self.win_opt.OneBtnMsgBox("提示", "登录成功!", QMessageBox.Information)
70 | # 关闭摄像头
71 | self.Cam_Opt.SavePic()
72 | # 跳转到主界面界面
73 | main_win = CMainWin(self.Cam_Opt, res, self.label_cam.pixmap(), self)
74 | main_win.show()
75 | # 关闭登陆界面
76 | self.close()
77 | return
78 |
79 | # 判断是否连接成功
80 | def BtnConnectInfo(self):
81 | """
82 | 定时器判断是否成功连接
83 | :return:
84 | """
85 | status = self.network.ConnectCheck()
86 | if status == 0:
87 | self.btn_connect.setIcon(QIcon(CORRECT_PIC))
88 | self.btn_connect.setText("百度AI连接成功")
89 | else:
90 | self.btn_connect.setIcon(QIcon(ERROR_PIC))
91 | info = "连接失败,错误码:" + str(status)
92 | self.btn_connect.setText(info)
93 |
94 | # 改变鼠标事件
95 | def mouseMoveEvent(self, e: QMouseEvent): # 重写移动事件
96 | self._endPos = e.pos() - self._startPos
97 | self.move(self.pos() + self._endPos)
98 |
99 | def mousePressEvent(self, e: QMouseEvent):
100 | if e.button() == Qt.LeftButton:
101 | self._isTracking = True
102 | self._startPos = QPoint(e.x(), e.y())
103 |
104 | def mouseReleaseEvent(self, e: QMouseEvent):
105 | if e.button() == Qt.LeftButton:
106 | self._isTracking = False
107 | self._startPos = None
108 | self._endPos = None
109 |
110 | # 相关槽函数
111 | def SlotGetFace(self):
112 | """
113 | 槽函数: 获取人脸
114 | :return:
115 | """
116 | self.Cam_Opt.SavePic()
117 | time.sleep(0.1) # 休眠一毫秒
118 | print(self.Cam_Opt.ReadSaveRes())
119 | if self.Cam_Opt.ReadSaveRes():
120 | self.win_opt.OneBtnMsgBox("提示", "图片抓取成功", QMessageBox.Information)
121 | # 检查照片内是否有人脸
122 | self.FaceJudge()
123 | else:
124 | self.win_opt.OneBtnMsgBox("提示", "图片抓取失败", QMessageBox.Critical)
125 |
126 | def SlotReGet(self):
127 | """
128 | 槽函数, 重新捕获
129 | :return:
130 | """
131 | # 已经启动了
132 | if self.Cam_Opt.is_start:
133 | self.win_opt.OneBtnMsgBox("提示", "相机镜头已经魔法展开了!", QMessageBox.Critical)
134 | else:
135 | self.Cam_Opt.SavePic()
136 | self.Cam_Opt.ThreadOptShowVideo('', self.label_cam, False, False)
137 |
138 | def SlotToReg(self):
139 | """
140 | 槽函数, 跳转到登陆界面
141 | :return:
142 | """
143 | # 确认跳转
144 | res = self.win_opt.TwoBtnMsgBox("重复", "是否确认跳转到注册界面?", QMessageBox.Critical)
145 | if res == True:
146 | # 进入注册界面
147 | if self.__parent != None:
148 | self.Cam_Opt.ExitCam()
149 | # 跳转到注册界面
150 | time.sleep(0.1)
151 | self.__parent.SlotToRegWin()
152 | # 关闭本窗口
153 | self.close()
154 | else:
155 | self.win_opt.OneBtnMsgBox("提示", "无法进入注册界面,请从主界面进入!", QMessageBox.Critical)
156 |
157 | def SlotReturn(self):
158 | """
159 | 槽函数: 返回上级菜单
160 | :return:
161 | """
162 | # 关闭本窗口,返回主界面
163 | if self.__parent != None:
164 | self.__parent.show()
165 | self.close()
166 |
167 | def FaceJudge(self):
168 | """
169 | 槽函数: 人脸判断
170 | :return:
171 | """
172 | img = self.label_cam.pixmap()
173 | img = face_detection.QpixmapToCvImg(img)
174 | self.output_res = face_detection.FaceDetection(img)
175 | if len(self.output_res) == 0:
176 | self.win_opt.OneBtnMsgBox("提示", "未捕获到人脸,请重试!", QMessageBox.Critical)
177 | self.SlotReGet()
178 | elif len(self.output_res) == 1:
179 | self.win_opt.OneBtnMsgBox("提示", "成功捕获人脸!", QMessageBox.Information)
180 | else:
181 | self.win_opt.OneBtnMsgBox("提示", "捕获到多张人脸,请重试!", QMessageBox.Critical)
182 | self.SlotReGet()
183 |
--------------------------------------------------------------------------------
/win/CRegWin.py:
--------------------------------------------------------------------------------
1 | import time
2 |
3 | from PyQt5.QtCore import *
4 | from PyQt5.QtGui import *
5 | from PyQt5.QtWidgets import *
6 |
7 | from CAiFaceDetection import CAiFaceDetection
8 | from CCamOpt import CCamOpt
9 | from CNetWork import CNetWork
10 | from Global import BACKGROUND_PATH, CORRECT_PIC, ERROR_PIC, face_detection
11 | from ui_file.ui_reg import *
12 | from win.CWinOpt import *
13 |
14 |
15 | class CRegWin(QWidget, Ui_reg):
16 | _startPos = None
17 | _endPos = None
18 | _isTracking = False
19 |
20 | # 获取相机
21 | def __init__(self, mask_check, parent=None):
22 | super(CRegWin, self).__init__() # super() 函数是用于调用父类(超类)的一个方法。
23 | self.setupUi(self)
24 | self.__parent = parent
25 | self.__isFace = False
26 | self.__res = False
27 | self.__output_res = []
28 | self.__status = 0
29 |
30 | # 实例化相关类
31 | self.win_opt = CWinOpt()
32 | self.ai_face = CAiFaceDetection()
33 | self.mask_check = mask_check
34 | self.__c_timer = QTimer()
35 | self.network = CNetWork()
36 |
37 | # 界面设置
38 | self.win_opt.drawn(BACKGROUND_PATH, self)
39 | self.setWindowFlags(Qt.FramelessWindowHint) # 无边框
40 | self.edit_user_name.clear()
41 | self.edit_user_name.setTextMargins(15, 0, 0, 0)
42 |
43 | # 连接槽函数
44 | self.__c_timer.timeout.connect(self.showTime) # 这个通过调用槽函数来刷新时间
45 | #self.__c_timer.timeout.connect(self.BtnConnectInfo) # 这个通过调用槽函数来刷新时间
46 |
47 | self.btn_get_face.clicked.connect(self.SlotGetFace) # 捕获人脸按钮
48 | self.btn_reget.clicked.connect(self.SlotReGet) # 捕获人脸按钮
49 | self.btn_return.clicked.connect(self.SlotReturn) # 跳转到上级菜单
50 | self.btn_decide.clicked.connect(self.SlotDecide) # 确定发送图片信息
51 |
52 | # 启动定时器
53 | self.startTimer()
54 |
55 | # 启动注册
56 | self.StartCam()
57 |
58 | # 启动相机
59 | def StartCam(self):
60 | # 设置标签
61 | self.Cam_Opt = CCamOpt("./temp/", 0, self.win_opt, self.ai_face, self.mask_check)
62 | self.Cam_Opt.ThreadOptShowVideo('', self.label_cam, False, False)
63 |
64 | # 判断是否连接成功
65 | def BtnConnectInfo(self):
66 | status = self.network.ConnectCheck()
67 | if status == 0:
68 | self.pushButton.setIcon(QIcon(CORRECT_PIC))
69 | self.pushButton.setText("百度AI连接成功")
70 | else:
71 | self.pushButton.setIcon(QIcon(ERROR_PIC))
72 | info = "连接失败,错误码:" + str(status)
73 | self.pushButton.setText(info)
74 |
75 | # 改变鼠标事件
76 | def mouseMoveEvent(self, e: QMouseEvent): # 重写移动事件
77 | self._endPos = e.pos() - self._startPos
78 | self.move(self.pos() + self._endPos)
79 |
80 | def mousePressEvent(self, e: QMouseEvent):
81 | if e.button() == Qt.LeftButton:
82 | self._isTracking = True
83 | self._startPos = QPoint(e.x(), e.y())
84 |
85 | def mouseReleaseEvent(self, e: QMouseEvent):
86 | if e.button() == Qt.LeftButton:
87 | self._isTracking = False
88 | self._startPos = None
89 | self._endPos = None
90 |
91 | # 进行时间
92 | def showTime(self):
93 | time = QDateTime.currentDateTime() # 获取当前时间
94 | time_display = time.toString("yyyy-MM-dd hh:mm:ss") # 格式化一下时间
95 | self.edit_time.setText(time_display)
96 |
97 | def startTimer(self):
98 | self.__c_timer.start(1000) # 每隔一秒刷新一次,这里设置为1000ms
99 | self.showTime()
100 |
101 | def SlotGetFace(self):
102 | str = self.edit_user_name.text()
103 | if len(str) == 0:
104 | self.win_opt.OneBtnMsgBox("警告", "请先输入用户名", QMessageBox.Warning)
105 | return
106 | else:
107 | self.Cam_Opt.SavePic()
108 | time.sleep(0.1)
109 | if self.Cam_Opt.ReadSaveRes():
110 | self.win_opt.OneBtnMsgBox("提示", "照片捕获成功", QMessageBox.Information)
111 | # 检查照片内是否有人脸
112 | self.FaceJudge()
113 | else:
114 | self.win_opt.OneBtnMsgBox("提示", "照片捕获失败", QMessageBox.Critical)
115 |
116 | def SlotReGet(self):
117 | # 已经启动了
118 | if self.Cam_Opt.is_start:
119 | self.win_opt.OneBtnMsgBox("提示", "相机镜头已经魔法展开了!", QMessageBox.Critical)
120 | else:
121 | self.Cam_Opt.ThreadOptShowVideo('', self.label_cam, False, False)
122 |
123 | def SlotReturn(self):
124 | # 关闭本窗口,打开父窗口
125 | if self.__parent != None:
126 | self.__parent.show()
127 | self.close()
128 |
129 | def SlotDecide(self):
130 | # 判断是否有可发送的数据
131 | if len(self.__output_res) == 0:
132 | self.win_opt.OneBtnMsgBox("警告", "未捕获照片or捕获照片非法", QMessageBox.Critical)
133 | return
134 | # 去百度网盘检测是否有重复脸
135 | res = self.ai_face.UserQuire(self.edit_user_name.text(), "safeGuard")
136 | if res == '0':
137 | self.win_opt.OneBtnMsgBox("警告", "存在同名用户,请重试!!", QMessageBox.Critical)
138 | return
139 | # 判断是否有重复的人脸
140 | res = self.ai_face.FaceResearch(self.__output_res[0], "safeGuard")
141 | if len(res) == 0:
142 | # 写入百度云人脸库
143 | res = self.ai_face.FaceAdd(self.edit_user_name.text(), self.__output_res[0], "safeGuard")
144 | if res:
145 | self.win_opt.OneBtnMsgBox("提示", "人脸注册成功!", QMessageBox.Information)
146 | else:
147 | self.win_opt.OneBtnMsgBox("提示", "人脸注册失败, 请检查百度API连接!", QMessageBox.Information)
148 | else:
149 | self.win_opt.OneBtnMsgBox("警告", "系统已经存在该人脸, 请直接用该脸登陆, 谢谢", QMessageBox.Critical)
150 |
151 | def FaceJudge(self):
152 | img = self.label_cam.pixmap()
153 | img = face_detection.QpixmapToCvImg(img)
154 | self.__output_res = face_detection.FaceDetection(img)
155 | if len(self.__output_res) == 0:
156 | self.win_opt.OneBtnMsgBox("提示", "未识别到人脸,请重试!", QMessageBox.Critical)
157 | self.SlotReGet()
158 | elif len(self.__output_res) == 1:
159 | self.win_opt.OneBtnMsgBox("提示", "成功捕获人脸!", QMessageBox.Information)
160 | else:
161 | self.win_opt.OneBtnMsgBox("提示", "识别到多张人脸,请重试!", QMessageBox.Critical)
162 | self.SlotReGet()
163 |
--------------------------------------------------------------------------------
/win/CStartWin.py:
--------------------------------------------------------------------------------
1 | from CMaskDetection import CMaskDetection
2 | from ui_file.ui_start import *
3 | from win.CLoginWin import *
4 | from win.CRegWin import *
5 | from PyQt5.QtWidgets import QMessageBox, QMainWindow
6 | import sys
7 |
8 |
9 | class CStartWin(QMainWindow, Ui_start):
10 | """
11 | 主界面
12 | """
13 |
14 | def __init__(self):
15 | super(QMainWindow, self).__init__() # super() 函数是用于调用父类(超类)的一个方法。
16 | self.setupUi(self)
17 | # 连接槽函数
18 | self.btn_face_reg.clicked.connect(self.SlotToRegWin)
19 | self.btn_face_recognition.clicked.connect(self.SlotToRecognition)
20 | self.btn_exit.clicked.connect(self.SlotToExit)
21 | # 创建对象
22 | self.mask_check = CMaskDetection()
23 | self.win_opt = CWinOpt()
24 |
25 | def SlotToRegWin(self):
26 | """
27 | 跳转到注册界面
28 | :return:
29 | """
30 | self.reg_win = CRegWin(self.mask_check, self)
31 | self.reg_win.show()
32 | self.hide()
33 |
34 | def SlotToRecognition(self):
35 | """
36 | 跳转到人脸识别界面
37 | :return:
38 | """
39 | self.login_win = CLoginWin(self.mask_check, self)
40 | self.login_win.show()
41 | self.hide()
42 |
43 | def SlotToExit(self):
44 | """
45 | 退出程序
46 | :return:
47 | """
48 | if self.win_opt.TwoBtnMsgBox('警告', '是否退出程序?', QMessageBox.Warning):
49 | sys.exit(0)
50 |
--------------------------------------------------------------------------------
/win/CTableWidget.py:
--------------------------------------------------------------------------------
1 | from PyQt5 import QtCore, QtGui, QtWidgets
2 | import sys
3 |
4 | class NewTableWidget(QtWidgets.QWidget):
5 |
6 | def __init__(self,lst):
7 | super().__init__()
8 | self.resize(800,300)
9 | self.hlayout = QtWidgets.QHBoxLayout(self)
10 | self.lst = lst
11 | self.newTableWidget()
12 |
13 | # 表格控件
14 | def newTableWidget(self):
15 | label7 = QtWidgets.QLabel('已添加:')
16 | self.tableWidget = QtWidgets.QTableWidget()
17 | self.tableWidget.setRowCount(3)
18 | self.tableWidget.setColumnCount(len(self.lst))
19 | self.tableWidget.setHorizontalHeaderLabels(self.lst)
20 | self.tableWidget.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch) # 使列表自适应宽度
21 | self.tableWidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) # 设置tablewidget不可编辑
22 | self.tableWidget.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection) # 设置tablewidget不可选中
23 | for i in range(3):
24 | self.tableWidget.setCellWidget(i, len(self.lst) - 1, self.buttonForRow()) # 在最后一个单元格中加入修改、删除按钮
25 | self.hlayout.addWidget(label7)
26 | self.hlayout.addWidget(self.tableWidget)
27 |
28 | def buttonForRow(self):
29 | widget = QtWidgets.QWidget()
30 | # 修改
31 | self.updateBtn = QtWidgets.QPushButton('修改')
32 | self.updateBtn.setStyleSheet(''' text-align : center;
33 | background-color : NavajoWhite;
34 | height : 30px;
35 | border-style: outset;
36 | font : 13px ''')
37 |
38 | # 删除
39 | self.deleteBtn = QtWidgets.QPushButton('删除')
40 | self.deleteBtn.setStyleSheet(''' text-align : center;
41 | background-color : LightCoral;
42 | height : 30px;
43 | border-style: outset;
44 | font : 13px; ''')
45 | self.deleteBtn.clicked.connect(self.DeleteButton)
46 |
47 | hLayout = QtWidgets.QHBoxLayout()
48 | hLayout.addWidget(self.updateBtn)
49 | hLayout.addWidget(self.deleteBtn)
50 | hLayout.setContentsMargins(5, 2, 5, 2)
51 | widget.setLayout(hLayout)
52 | return widget
53 |
54 | def DeleteButton(self):
55 | button = self.sender()
56 | if button:
57 | # 确定位置的时候这里是关键
58 | row = self.tableWidget.indexAt(button.parent().pos()).row()
59 | #self.tableWidget.removeRow(row)
60 | print(row)
61 |
--------------------------------------------------------------------------------
/win/CWinManage.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/win/CWinManage.py
--------------------------------------------------------------------------------
/win/CWinOpt.py:
--------------------------------------------------------------------------------
1 | from PyQt5.QtGui import QPalette, QBrush, QPixmap, QIcon
2 | from PyQt5.QtWidgets import QMessageBox
3 | import Global
4 | import numpy as np
5 |
6 |
7 | class CWinOpt():
8 | def __init__(self):
9 | self.mesBox = QMessageBox()
10 | # 设置窗体ICON
11 | self.mesBox.setWindowIcon(QIcon("ui_file/resource/icon/icon.png"))
12 | # 样式设置
13 | self.mesBox.setStyleSheet(Global.QSS)
14 |
15 | # 绘制背景图片
16 | # "./ui_file/resource/img/background5.jpg"
17 | @staticmethod
18 | def drawn(picture_name, win):
19 | win.palette = QPalette()
20 | win.palette.setBrush(QPalette.Background, QBrush(QPixmap(picture_name)))
21 | win.setPalette(win.palette)
22 |
23 | @staticmethod
24 | def QPixmapToMat(qtpixmap):
25 | qimg = qtpixmap.toImage()
26 | temp_shape = (qimg.height(), qimg.bytesPerLine() * 8 // qimg.depth())
27 | temp_shape += (4,)
28 | ptr = qimg.bits()
29 | ptr.setsize(qimg.byteCount())
30 | result = np.array(ptr, dtype=np.uint8).reshape(temp_shape)
31 | result = result[..., :3]
32 | return result
33 |
34 | def OneBtnMsgBox(self, title, content, type):
35 | self.mesBox.setWindowTitle(title)
36 | self.mesBox.setText(content)
37 | self.mesBox.setIcon(type)
38 | # 按钮设置
39 | self.mesBox.setStandardButtons(QMessageBox.Yes)
40 | self.mesBox.button(QMessageBox.Yes).setText('确认')
41 | # 执行
42 | self.mesBox.exec_()
43 |
44 | def TwoBtnMsgBox(self, title, content, type):
45 | self.mesBox.setWindowTitle(title)
46 | self.mesBox.setText(content)
47 |
48 | # 设置窗体ICON
49 | self.mesBox.setWindowIcon(QIcon("ui_file/resource/icon/icon.png"))
50 | self.mesBox.setIcon(type)
51 |
52 | # 按钮设置
53 | self.mesBox.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
54 | btn_yes = self.mesBox.button(QMessageBox.Yes)
55 | btn_yes.setText('赶紧确定')
56 | btn_no = self.mesBox.button(QMessageBox.No)
57 | btn_no.setText('容我三思')
58 | # 执行
59 | self.mesBox.exec_()
60 |
61 | if self.mesBox.clickedButton() == btn_yes:
62 | return True
63 | elif self.mesBox.clickedButton() == btn_no:
64 | return False
65 |
--------------------------------------------------------------------------------
/win/CWinStart.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/idle147/Intelligent_safe_guard_software/5ce32448b3781f5ed5322c09806919208c93c2a0/win/CWinStart.py
--------------------------------------------------------------------------------