I am building a robot with face detection and recognition function. I have got the face detection part working. However for face recognition I am getting the following error (using python):
Traceback (most recent call last):
File "02_face_training.py", line 21, in <module>
recognizer = cv2.face.LBPHFaceRecognizer_create()
AttributeError: 'module' object has no attribute 'face'
I was on opencv 3.2 so I upgraded to opencv 3.4.6 but get the same error.
So I started digging in the source code, and sure enough I don't see any cpp code that defines the Face class, so I am not sure what's going on. I even downloaded 4.1 (did not install) just to go through its source and even that did not have any implementation related to face recognition (or at least I could not find it).
This is the code that is causing the issue:
import cv2
import numpy as np
from PIL import Image
import os
# Path for face image database
path = 'dataset'
recognizer = cv2.face.LBPHFaceRecognizer_create()
detector = cv2.CascadeClassifier("haarcascade_frontalface_default.xml");
Is there some separate module that I need to install for face recognition in opencv?
I am using python 2.7.
Any help will be appreciated. Thanks.
contrib
modules as described here: How to build OpenCV with extra modules