informramiz / opencv-face-recognition-python

Face Recognition using OpenCV and Python.
MIT License
518 stars 351 forks source link

training on EigenFace and FisherFace failed. #9

Open arasharchor opened 6 years ago

arasharchor commented 6 years ago

by just commenting LBF and uncommenting FisherFace or EigenFace I am getting the following error

face_recognizer.train(faces, np.array(labels)) cv2.error: OpenCV(3.4.1) /home/majid/opencv_contrib/modules/face/src/eigen_faces.cpp:72: error: (-210) In the Eigenfaces method all input samples (training images) must be of equal size! Expected 143641 pixels, but was 6724 pixels. in function train

ramineniraviteja commented 6 years ago

Use LBPHFace recognizer. for this all images doesn't need to be in same size.

ghost commented 6 years ago

def predict(test_img):

img = test_img.copy()
face, rect = detect_face(img)
face = cv2.resize(face, (100, 100))
label_text, confidence = face_recognizer.predict(face)

return label_text
AyushTejwani commented 6 years ago

for eigenface you need equal size of images the database as well as the testing images you can resize them for the code to work