Skip to content

Commit

Permalink
Updated project to work properly with OpenCV 3.4.3 and Python 3.6 (#4)
Browse files Browse the repository at this point in the history
* Update image_commons.py
* Update prepare_model.py
* Update webcam.py
  • Loading branch information
Anandesh-Sharma authored and PiotrDabrowskey committed Oct 30, 2018
1 parent 47c7256 commit db6c660
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
6 changes: 1 addition & 5 deletions image_commons.py
Expand Up @@ -3,11 +3,7 @@
"""
import cv2
import numpy as np

if cv2.__version__ == '3.1.0':
from PIL import Image
else:
import Image
from PIL import Image


def image_as_nparray(image):
Expand Down
6 changes: 2 additions & 4 deletions prepare_model.py
Expand Up @@ -9,10 +9,8 @@

from image_commons import load_image

if cv2.__version__ != '3.1.0':
fishface = cv2.createFisherFaceRecognizer()
else:
fishface = cv2.face.createFisherFaceRecognizer()

fishface = cv2.face.FisherFaceRecognizer_create()
training_set_size = 0.95


Expand Down
7 changes: 2 additions & 5 deletions webcam.py
Expand Up @@ -63,11 +63,8 @@ def show_webcam_and_run(model, emoticons, window_size=None, window_name='webcam'
emoticons = _load_emoticons(emotions)

# load model
if cv2.__version__ == '3.1.0':
fisher_face = cv2.face.createFisherFaceRecognizer()
else:
fisher_face = cv2.createFisherFaceRecognizer()
fisher_face.load('models/emotion_detection_model.xml')
fisher_face = cv2.face.FisherFaceRecognizer_create()
fisher_face.read('models/emotion_detection_model.xml')

# use learnt model
window_name = 'WEBCAM (press ESC to exit)'
Expand Down

0 comments on commit db6c660

Please sign in to comment.