-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (19 loc) · 680 Bytes
/
Copy pathmain.py
File metadata and controls
30 lines (19 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import cv2
from emotions import detect_emotion
cap = cv2.VideoCapture(0)
cv2.namedWindow("Emotion Project", cv2.WINDOW_NORMAL)
cv2.setWindowProperty("Emotion Project", cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
while True:
success, frame = cap.read()
frame = cv2.flip(frame, 1)
emotion = detect_emotion(frame)
img = cv2.imread(f"{emotion}.jpeg")
img = cv2.resize(img, (250, 250))
frame[20:270, 20:270] = img
cv2.putText(frame, emotion.upper(), (300, 80),
cv2.FONT_HERSHEY_SIMPLEX, 2, (0,255,0), 3)
cv2.imshow("Emotion Project", frame)
if cv2.waitKey(1) == 27:
break
cap.release()
cv2.destroyAllWindows()