0

I want to work on this face recognition project but when I run the train.py, I get the following error:

recognizer = cv2.face.createFisherFaceRecognizer()
AttributeError: 'module' object has no attribute 'face'

I've googled it but I didn't find anything useful.

I'm running python 2.7 and OpenCV 3.2.0.

Any help would be appreciated.

7
  • probably your "import cv2" never imported correctly Commented Feb 19, 2017 at 12:21
  • @user1767754 it is installed correctly, but I think this is because of the OpenCV version. I haven't found anything helpful on the web. Commented Feb 19, 2017 at 14:32
  • The "face" module is from opencv_contrib. Are you sure that the build of OpenCV you're using contains this? AFAIK most of the standard builds don't contain the contrib modules. Commented Feb 19, 2017 at 16:37
  • 1
    @DanMašek Thanks man, your first comment helped a lot. The answer is to use OpenCV3 to work. Something like this: brew install opencv3 --with-contrib Commented Feb 19, 2017 at 22:12
  • 1
    @mohamaddanesh Great. However, instead of editing your title as you have, you should write your own answer to your question (and accept it). Commented Feb 19, 2017 at 22:14

1 Answer 1

1

As @DanMašek in the comments said, the answer is to add the open_contrib module in the OpenCV to use face module. It can be done while installing OpenCV, like this:

brew install opencv3 --with-contrib
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.