Opencv3 and Python 2.7 on Virtual Enviorement - AttributeError: 'module' object has no attribute 'createLBPHFaceRecognizer'

asked 2015-11-10 14:21:29 -0500

Gkan gravatar image

I have python function with opencv 3. it is normally working without virtual enviorement.Also I installed opencv on venv from:pyimagesearch. i am trying to run that python function on venv, then it is getting error :

AttributeError: 'module' object has no attribute 'createLBPHFaceRecognizer'

without venv in terminal:

gkhan@Gkan ~/Masaüstü/face_recognizer $ python face_recognizer.py
Yol :./sinif/114.jpg.
114 Yuz Tanindi 12

with venv in terminal:

gkhan@Gkan ~/Masaüstü/face_recognizer $ workon cv
(cv)gkhan@Gkan ~/Masaüstü/face_recognizer $ python face_recognizer.py
Traceback (most recent call last):
  File "face_recognizer.py", line 15, in <module>
    recognizer = cv2.createLBPHFaceRecognizer()
AttributeError: 'module' object has no attribute 'createLBPHFaceRecognizer'

my python codes:

#!/usr/bin/python
# -*- coding: utf-8 -*-

    import cv2, os
    import numpy as np
    from PIL import Image

    # For Test
    if 0==0:

        cascadePath = "haarcascade_frontalface_default.xml"
        faceCascade = cv2.CascadeClassifier(cascadePath)

        recognizer = cv2.createLBPHFaceRecognizer()
    ...

Linux Mint 64 Bit, Opencv3, python2.7

edit retag flag offensive close merge delete

Comments

you will need the opencv_contrib repo , an then it's :

recognizer = cv2.face.createLBPHFaceRecognizer() # note submodule / namespace
berak gravatar imageberak ( 2015-11-11 08:01:42 -0500 )edit
1

I did all of them about install from link but still the same error.

Gkan gravatar imageGkan ( 2015-11-14 14:20:59 -0500 )edit