ev6 commited on
Commit
eaa0408
·
verified ·
1 Parent(s): 22ce9c3

Update app/apps/emotion_recognition/emotion_recognition.py

Browse files
app/apps/emotion_recognition/emotion_recognition.py CHANGED
@@ -28,7 +28,7 @@ classes = list(class_labels.values())
28
  face_classifier = cv2.CascadeClassifier(os.path.join(
29
  BASE_DIR,'model/haarcascade_frontalface.xml'))
30
 
31
- camera = cv2.VideoCapture(0)
32
 
33
 
34
  def text_on_detected_boxes(text, text_x, text_y, image, font_scale=1,
@@ -127,16 +127,16 @@ def emotionImageFromArray(img_array):
127
 
128
  return image, precentages, label
129
 
130
- def face_detector_video(img):
131
- gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
132
- faces = face_classifier.detectMultiScale(gray, 1.3, 5)
133
- if faces is ():
134
- return (0, 0, 0, 0), np.zeros((48, 48), np.uint8), img
135
- for (x, y, w, h) in faces:
136
- cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 0), thickness=2)
137
- roi_gray = gray[y:y + h, x:x + w]
138
- roi_gray = cv2.resize(roi_gray, (48, 48), interpolation=cv2.INTER_AREA)
139
- return (x, w, y, h), roi_gray, img
140
 
141
 
142
  # def emotionVideo():
 
28
  face_classifier = cv2.CascadeClassifier(os.path.join(
29
  BASE_DIR,'model/haarcascade_frontalface.xml'))
30
 
31
+ # camera = cv2.VideoCapture(0)
32
 
33
 
34
  def text_on_detected_boxes(text, text_x, text_y, image, font_scale=1,
 
127
 
128
  return image, precentages, label
129
 
130
+ # def face_detector_video(img):
131
+ # gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
132
+ # faces = face_classifier.detectMultiScale(gray, 1.3, 5)
133
+ # if faces is ():
134
+ # return (0, 0, 0, 0), np.zeros((48, 48), np.uint8), img
135
+ # for (x, y, w, h) in faces:
136
+ # cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 0), thickness=2)
137
+ # roi_gray = gray[y:y + h, x:x + w]
138
+ # roi_gray = cv2.resize(roi_gray, (48, 48), interpolation=cv2.INTER_AREA)
139
+ # return (x, w, y, h), roi_gray, img
140
 
141
 
142
  # def emotionVideo():