-1

I am trying to implement face recognition code using Python 2.7 and OpenCV 3.4.1, but I get an error when running the code:

face_recognizer = cv2.face.LBPHFaceRecognizer_create()

The error message:

AttributeError: 'module' object has no attribute 'face'

How can I resolve this?

plamut
  • 3,085
  • 10
  • 29
  • 40

1 Answers1

0

You need to install opencv-contrib-python. Opencv has moved some functions over to the contribution package. Try running pip install opencv-contrib-python and then import that module.

Edit: This is assuming that you are using the regular opencv package, as this seems to be the most common problem.

L3gionOfDooM
  • 75
  • 1
  • 7