Ask Your Question
0

How to compile Python bindings for FaceRecognizer

asked 2012-08-07 17:19:49 -0600

srleod gravatar image

I'm trying to use OpenCV's awesome looking face recognition module from python, but it looks like the bindings aren't working.

>>> import cv2
>>> cv2.createFisherFaceRecognizer()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'createFisherFaceRecognizer'

I'm on Ubuntu 10.04 64-bit, using stock python 2.6.5. I compiled OpenCV myself from the 2.4.2 source tarball. Everything else I've tried from the library works fine in python. But none of the face reco stuff seems to be available in Python.

I read in this answer (dated July 11) that "The Python wrapper for cv::FaceRecognizer works now." Seeing that OpenCV 2.4.2 was released about a week before that, do I need to grab the source from the trunk and recompile?

Thanks!

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2012-08-08 01:23:53 -0600

updated 2012-08-08 10:50:33 -0600

Yes, you need to recompile it from the latest sources. I fixed the bug short after the release, it was a fault on my side, sorry for that. If you compile it yourself on Ubuntu, make sure you install the python-dev and python-numpy packages from the Ubuntu repositories. Then the Python bindings should be built correctly.

edit flag offensive delete link more

Comments

No problem -- thanks for confirming that I'm not crazy. And thanks for all your work!

srleod gravatar imagesrleod ( 2012-08-08 10:06:54 -0600 )edit

Hi, i'm getting mad... i've downloaded the latest version with git today (git://code.opencv.org/opencv.git) and compiled it, BUT i'm still getting the same error message: nhandled AttributeError "'module' object has no attribute 'createEigenFaceRecognizer'"

what am i doing wrong??? PLZ could you give advise? (if possible...step by step guide, 'cause i'm trying for a week now without luck) Thanks for any help and reply

infantilo gravatar imageinfantilo ( 2012-10-13 07:03:56 -0600 )edit

Operating System (32/64 bit)? Compiler? CMake Output? Python Version? Please give me as much informations as possible to reproduce the problem.

Philipp Wagner gravatar imagePhilipp Wagner ( 2012-10-13 07:30:23 -0600 )edit

MANY(!!!) thanks for quick reply. Asus EEE PC 1000H Ubuntu 12.04 32bit Python 2.7 got source from: git clone git://code.opencv.org/opencv.git cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON /home/me/opencv/

what is working for me: detecting the faces (by haarcascade), draw the rectangle around and add a textstring....

i've now tried SPE's intellisense, and it does not show cv.CreateEigenFaceRecognizer at all. :-(

infantilo gravatar imageinfantilo ( 2012-10-13 09:11:00 -0600 )edit

Ok. I'll set up a VM with your setup and write a Step-by-Step Guide.

Philipp Wagner gravatar imagePhilipp Wagner ( 2012-10-13 09:27:16 -0600 )edit

May i ask if you've found any solution???

infantilo gravatar imageinfantilo ( 2012-10-16 09:42:30 -0600 )edit

I didn't have any spare time to set up the VM.

Philipp Wagner gravatar imagePhilipp Wagner ( 2012-10-16 12:05:34 -0600 )edit
1

answered 2013-01-15 12:24:37 -0600

dr460neye gravatar image

Hi there, here a short tutorial how to fix the error.

Goto: http://opencv.willowgarage.com/wiki/InstallGuide

  • Download the latest version of Opencv with git: git clone git://code.opencv.org/opencv.git

  • Install Cmake, then start the cmake gui.

  • Click Configure and chose your ide and setup everything like in the InstallGuide.

So , here is the part i couldn't find in the documentations:

Add a new Entry: Type Boolean Name BUILD_NEW_PYTHON_SUPPORT Checkbox = true

Add a new Entry: Type String Name CMAKE_BUILD_TYPE Value = RELEASE

Now press generate.

Now you got a projectsetup. Follow the instructions in the installguide to compile.

Search for the pyd or so file and add it like normal to your python installation.

  • Add the new opencv debug and release folders to you path.
  • Add the folder which contains the pyd/so files to your path. Now you should be able to use the Face Recognition
edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-08-07 17:19:49 -0600

Seen: 6,155 times

Last updated: Jan 15 '13