Signed-off-by: sairate <sairate@sina.cn>

This commit is contained in:
sairate 2024-08-28 15:10:52 +08:00
parent a26f477409
commit 05e0e3055d
13 changed files with 9 additions and 4335 deletions

File diff suppressed because it is too large Load Diff

2
app.py
View File

@ -47,7 +47,7 @@ def info_person():
face_encodings = face_recognition.face_encodings(loaded_image)
if face_encodings:
encoding = ','.join(map(str, face_encodings[0])) # 将编码转换为字符串存储
encoding = ','.join(map(lambda x: format(x, 'b'), face_encodings[0]))
image_path = "db_image/"+image.filename # 仅保存文件名以便后续使用
else:
return "No face detected in the uploaded image."

BIN
captured_faces/face_1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
captured_faces/face_10.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
captured_faces/face_2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
captured_faces/face_3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
captured_faces/face_4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
captured_faces/face_5.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
captured_faces/face_6.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
captured_faces/face_7.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
captured_faces/face_8.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
captured_faces/face_9.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -53,8 +53,6 @@ def add_face_to_database(name, identity, image_path, db_name="face_database.db")
conn.commit()
conn.close()
def match_faces(captured_images, db_name="face_database.db", tolerance=0.4, log_file="match_log.txt"):
"""比对抓拍的图片与数据库中的已知人脸"""
conn = sqlite3.connect(db_name)
@ -90,8 +88,6 @@ def match_faces(captured_images, db_name="face_database.db", tolerance=0.4, log_
conn.close()
return False
def log_match(name, identity, db_image_path, db_name, log_file):
"""记录匹配结果,将数据库中的图片路径和匹配时间添加到匹配记录表单中"""
conn = sqlite3.connect(db_name)
@ -108,7 +104,6 @@ def log_match(name, identity, db_image_path, db_name, log_file):
conn.commit()
conn.close()
# # 创建人脸数据库
# create_face_database()
#
@ -168,3 +163,4 @@ while True:
time.sleep(30)
cap.release()
cv2.destroyAllWindows()