Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV 3.0.0, FaceRecognizer and Python Bindings

Hi there -

I am very new to OpenCV and am using it for a school project on the Raspberry Pi (Mine is the B+ model). I have followed numerous guides to get the FaceRecognizer to work in Python, but to no avail.

My specific problem is -

model = cv2.createEigenFaceRecognizer()
attributeError: 'module' object has no attribute 'createEigenFaceRecognizer'

I also want to note that I can do

import cv2

with no issues, and run functions such as

cv2.imwrite(), cv2.cvtColor()

with no problems, so there isn't an issue with OpenCV not working in general. My problem is with this specific class (faceRecognizer) which is critical for me.

To elaborate, I am running OpenCV 3.0.0 and Python 2.7.3. To install OpenCV, I basically followed the tutorial at http://mitchtech.net/raspberry-pi-opencv/, but instead of getting the file from sourceforge, I cloned from the OpenCV repository for the latest version, and in cMake, I added a flag BUILD_PYTHON_NEW_SUPPORT=ON (per a suggestion found online.)

I googled extensively to find a solution, most notably

http://answers.opencv.org/question/253/broken-python-bindings-with-createeigenfacerecognizer/

http://answers.opencv.org/question/1215/how-to-compile-python-bindings-for-facerecognizer/

http://www.raspberrypi.org/forums/viewtopic.php?f=33&t=81503&sid=57e53894dff75f4f18c8bd0e5339239d&start=25

and most sources tell me just to "recompile from the latest source". That's what I thought I did. I'm stuck as where to go now - did I compile the library incorrectly? I am aware that OpenCV is written in C++ and there are python bindings to make functions work in python, but I'm not sure where I'm going wrong here. Any input is much appreciated.