AttributeError: 'module' object has no attribute 'createFisherFaceRecognizer'
AttributeError: 'module' object has no attribute 'createFisherFaceRecognizer'
我正在使用 Ubuntu 16.04(64 位)python2.7 Open-CV 3.1.0
我已经按照下载 Open-CV 额外模块存储库的步骤通过以下方式激活此功能
https://github.com/opencv/opencv_contrib,
但是我遇到了同样的错误,我也尝试使用最新的 Open-CV 3.2.0 而不是 3.1.0 但我遇到了同样的错误:
AttributeError: 'module' object has no attribute 'createFisherFaceRecognizer'.
我的部分代码:
import numpy as np
import cv2
import sys
import os
class TrainFisherFaces:
def __init__(self):
cascPath = "haarcascade_frontalface_default.xml"
self.face_cascade = cv2.CascadeClassifier(cascPath)
self.face_dir = 'data'
self.face_name = sys.argv[1]
self.path = os.path.join(self.face_dir, self.face_name)
if not os.path.isdir(self.path):
os.mkdir(self.path)
self.model = cv2.createFisherFaceRecognizer()
createFisherFaceRecognizer() 似乎在 sub-module cv2.face 中 python .要访问它,您应该 cv2.face.createFisherFaceRecognizer().
来源:
改编自教程 example,用于在 c++ 中进行人脸识别。我已经安装了问题中描述的安装并进行了测试。
我按照此处的说明操作:
https://pypi.python.org/pypi/opencv-contrib-python
只需要做:pip install opencv-contrib-python
此外,我不得不使用 cv2.face.FisherFaceRecognizer_create()
我遇到了同样的问题并通过这种方式解决了它:
self.model = cv2.face.FisherFaceRecognizer_create()
我正在使用 Ubuntu 16.04(64 位)python2.7 Open-CV 3.1.0 我已经按照下载 Open-CV 额外模块存储库的步骤通过以下方式激活此功能 https://github.com/opencv/opencv_contrib, 但是我遇到了同样的错误,我也尝试使用最新的 Open-CV 3.2.0 而不是 3.1.0 但我遇到了同样的错误:
AttributeError: 'module' object has no attribute 'createFisherFaceRecognizer'.
我的部分代码:
import numpy as np
import cv2
import sys
import os
class TrainFisherFaces:
def __init__(self):
cascPath = "haarcascade_frontalface_default.xml"
self.face_cascade = cv2.CascadeClassifier(cascPath)
self.face_dir = 'data'
self.face_name = sys.argv[1]
self.path = os.path.join(self.face_dir, self.face_name)
if not os.path.isdir(self.path):
os.mkdir(self.path)
self.model = cv2.createFisherFaceRecognizer()
createFisherFaceRecognizer() 似乎在 sub-module cv2.face 中 python .要访问它,您应该 cv2.face.createFisherFaceRecognizer().
来源:
改编自教程 example,用于在 c++ 中进行人脸识别。我已经安装了问题中描述的安装并进行了测试。
我按照此处的说明操作: https://pypi.python.org/pypi/opencv-contrib-python
只需要做:pip install opencv-contrib-python
此外,我不得不使用 cv2.face.FisherFaceRecognizer_create()
我遇到了同样的问题并通过这种方式解决了它:
self.model = cv2.face.FisherFaceRecognizer_create()