openCV错误“模块”对象没有属性“ createEigenFaceRecognizer”

时间:2019-09-14 18:24:45

标签: python opencv face-recognition

我在运行python 2.7.16 OpenCV 4.1.1时遇到的错误是python 'module' object has no attribute 'createEigenFaceRecognizer'我已经搜索过 此错误是因为OpenCV的版本,但在OpenCV 4.1.1中找不到createEigenFaceRecognizer()可以帮助我。

我尝试了“ cv2.face.createEigenFaceRecognizer()”和“ cv2.face_LBPHFaceRecognizer()”,但是有相同的错误

这是我的功能错误

def train_model(path):

    [images, labels, people]= get_images(sys.argv[1], (256, 256))

    labels= np.asarray(labels, dtype= np.int32)

    print("Initializing eigen FaceRecognizer and training...")
    sttime= time.clock()
    eigen_model= cv2.createEigenFaceRecognizer()
    eigen_model.train(images, labels)
    print("\tCompleted training in "+ str(time.clock()- sttime)+ " Secs!")

    return [eigen_model, people]

当我调用函数时

    arg_one= sys.argv[1]
    eigen_model, people= train_model(arg_one)

0 个答案:

没有答案