Reputation: 15
I'm using Ubuntu 16.04 (64bit) python2.7 Open-CV 3.1.0 I've followed the steps for downloading Repository for Open-CV extra modules to activate this function via https://github.com/opencv/opencv_contrib, However i got the same error, i also tried using the latest Open-CV 3.2.0 instead of 3.1.0 but i have got the same error:
AttributeError: 'module' object has no attribute 'createFisherFaceRecognizer'.
The part of my code:
import numpy as np
import cv2
import sys
import os
class TrainFisherFaces:
def __init__(self):
cascPath = "haarcascade_frontalface_default.xml"
self.face_cascade = cv2.CascadeClassifier(cascPath)
self.face_dir = 'data'
self.face_name = sys.argv[1]
self.path = os.path.join(self.face_dir, self.face_name)
if not os.path.isdir(self.path):
os.mkdir(self.path)
self.model = cv2.createFisherFaceRecognizer()
Upvotes: 1
Views: 9116
Reputation: 116
I had the same issue and fixed it by this way:
self.model = cv2.face.FisherFaceRecognizer_create()
Upvotes: 1
Reputation: 103
I followed the instructions here: https://pypi.python.org/pypi/opencv-contrib-python
And simply has to do: pip install opencv-contrib-python
Also, I had to use cv2.face.FisherFaceRecognizer_create()
Upvotes: 3
Reputation: 706
It seems that createFisherFaceRecognizer() is in the sub-module cv2.face in python. To access it you should cv2.face.createFisherFaceRecognizer().
Source:
Adapted from the tutorial example for face recognition in c++. I have the the installation as the one described in the question and tested it out.
Upvotes: 2