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()
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.