Attention! This forum will be made read-only by Dec-20. Please migrate to https://forum.opencv.org. Most of existing active users should've received invitation by e-mail.
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

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