Commit ec6fc745 authored by tihmels's avatar tihmels
Browse files

Refactoring

parent 3fe71c84
...@@ -22,7 +22,7 @@ def _load_emoticons(emotions): ...@@ -22,7 +22,7 @@ def _load_emoticons(emotions):
return [nparray_as_image(cv2.imread('resources/graphics/%s.png' % emotion, -1), mode=None) for emotion in emotions] return [nparray_as_image(cv2.imread('resources/graphics/%s.png' % emotion, -1), mode=None) for emotion in emotions]
def show_webcam_and_run(model, emoticons, window_size=None, window_name='webcam', update_time=10): def show_webcam_and_run(model, emoticons, window_size=(800, 800), window_name='Mood Expression', update_time=1):
""" """
Shows webcam image, detects faces and its emotions in real time and draw emoticons over those faces. Shows webcam image, detects faces and its emotions in real time and draw emoticons over those faces.
:param model: Learnt emotion detection model. :param model: Learnt emotion detection model.
...@@ -65,10 +65,8 @@ if __name__ == '__main__': ...@@ -65,10 +65,8 @@ if __name__ == '__main__':
emotions = ['neutral', 'anger', 'disgust', 'happy', 'surprise'] emotions = ['neutral', 'anger', 'disgust', 'happy', 'surprise']
emoticons = _load_emoticons(emotions) emoticons = _load_emoticons(emotions)
# load mode # load mode
fisher_face = cv2.face.FisherFaceRecognizer_create() fisher_face = cv2.face.FisherFaceRecognizer_create()
fisher_face.read('basis_data/models/detection_model.xml') fisher_face.read('basis_data/models/detection_model.xml')
# use learnt model # use learnt model
window_name = 'WEBCAM (press ESC to exit)' show_webcam_and_run(fisher_face, emoticons)
show_webcam_and_run(fisher_face, emoticons, window_size=(800, 800), window_name=window_name, update_time=1)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment