Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/recognition_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ def predict_expression():
# 如果检测到人脸
if faces is not None and len(faces) > 0:
for (x, y, w, h) in faces:
x = max(0, x)
y = max(0, y)
w = min(w, frame_gray.shape[1] - x)
h = min(h, frame_gray.shape[0] - y)
face = frame_gray[y: y + h, x: x + w] # 脸部图片
faces = generate_faces(face)
results = model.predict(faces)
Expand Down