Kuna
Kuna

Reputation: 21

openCV Error module 'cv2.face' has no attribute 'createEigenFaceRecognizer'

I am using python 3.7 and latest version of openCV. When i try to create an EigenFaceRecognizer. This error pops up "module 'cv2.face' has no attribute createEigenFaceRecognizer. I have got this bellow code from a Gitub repo.

recognise = cv2.face.createEigenFaceRecognizer(15, 4000)
recognise.load("Recogniser/trainingDataEigan.xml")

Upvotes: 2

Views: 1946

Answers (1)

nathancy
nathancy

Reputation: 46600

I believe the face module is in the opencv-contrib library. You can install it with

pip uninstall opencv-contrib-python
pip install opencv-contrib-python --no-cache-dir

Also the function got changed to this. load was replaced with read

import cv2

recognise = cv2.face.EigenFaceRecognizer_create()  
recognise.read("Recogniser/trainingDataEigan.xml")

Upvotes: 1

Related Questions