我正在尝试运行用于基本人脸识别的python脚本,但是从pip安装后运行时出现错误:
QObject::moveToThread: Current thread (0x24c8e90) is not the object's thread (0x20da6d0).
Cannot move to target thread (0x24c8e90)
我发现了this question并解决了问题,但之后我得到了这个错误:
Traceback (most recent call last):
File "face_recognition.py", line 21, in
recognizer = cv2.face.LBPHFaceRecognizer_create()
AttributeError: module 'cv2.face' has no attribute 'LBPHFaceRecognizer_create'
我找到了许多解决此问题的答案(for example),但所有人都建议从pip安装opencv-contrib-python
软件包。
如何从apt-get中包含所需的软件包?
出现错误的代码:
import cv2
import numpy as np
recognizer = cv2.face.LBPHFaceRecognizer_create()