I’m getting AttributeError: module ‘cv2.face’ has no attribute ‘createLBPHFaceRecognizer’ for the following code snippet.
import cv2 cascade = "haarcascade_frontalface_default.xml" face_Cascade = cv2.CascadeClassifier(cascade) recog = cv2.face.createLBPHFaceRecognizer()
in line 4:
recog = cv2.face.createLBPHFaceRecognizer()
can you please help me out? alternatives for this code snippet is appriciated.
The LBPHFaceRecognizer is created by
cv2.face.LBPHFaceRecognizer_create()
use LBPHFaceRecognizer_create() instead of createLBPHFaceRecognizer()
your code snippet will be
import cv2 cascade = "haarcascade_frontalface_default.xml" face_Cascade = cv2.CascadeClassifier(cascade) recog = cv2.face.LBPHFaceRecognizer_create()
If you haven’t installed opencv-contrib-python library, install it first, because in the default package i.e. opencv-python some functionalities are missing. You can install opencv-contrib-python by
pip install opencv-contrib-python

thanks a lot mukuldeep maiti