Signed-off-by: sairate <sairate@sina.cn>
4336
.idea/workspace.xml
2
app.py
|
@ -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."
|
||||
|
|
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 22 KiB |
|
@ -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()
|
||||
|
|