Reputation: 13
I have a problem with face detection.
code:
import cv2
import os
import numpy as np
from PIL import Image
path = 'dataSet'
cascadePath = "Classifiers/face.xml"
faceCascade = cv2.CascadeClassifier(cascadePath);
cam = cv2.VideoCapture(0)
recognizer = cv2.face.LBPHFaceRecognizer_create()
recognizer.load('trainer/trainer.yml')
AttributeError:
'cv2.face_LBPHFaceRecognizer' object has no attribute 'Load'
Help me, I already researched and still have not found an answer.
I am using python
3.6.1 and opencv
3.0
Upvotes: 1
Views: 4138
Reputation: 82078
That's because it doesn't have that property. You mean read
.
recognizer = cv2.face.LBPHFaceRecognizer_create()
recognizer.read('trainer/trainer.yml')
Here's the help:
| read(...)
| read(filename) -> None
| . @brief Loads a FaceRecognizer and its model state.
| .
| . Loads a persisted model and state from a given XML or YAML file . Every FaceRecognizer has to
| . overwrite FaceRecognizer::load(FileStorage& fs) to enable loading the model state.
| . FaceRecognizer::load(FileStorage& fs) in turn gets called by
| . FaceRecognizer::load(const String& filename), to ease saving a model.
Upvotes: 1