Ask Your Question

Revision history [back]

face.predict error in cv3 python 2.7

The following code works in cv2, but neither predict line works in cv3:

recognizer = cv2.face.createLBPHFaceRecognizer(radius=2, neighbors=16, grid_x=3, grid_y=3)
(prediction, conf) = recognizer.predict(testing.data[i])   #OR..
(prediction, conf) = cv2.face.predict(testing.data[i])

The attempt to call predict results in either : object is not iterable or object as no attribute 'predict' error

I found some old discussion related to this Face class,

https://github.com/peterbraden/node-opencv/pull/379/files
https://github.com/opencv/opencv_contrib/issues/184

but not sure if it's still relevant or if it's even the same issue I have. I'm pretty new to this, so I think I'm just calling it the wrong way, especially since predict is listed in the cv3 documentation:

http://docs.opencv.org/3.1.0/dd/d65/classcv_1_1face_1_1FaceRecognizer.html