我正在尝试使用网络摄像头进行实时/实时面部识别。我在用 : 人脸识别版本1.2.8 蟒蛇版本3.10.6 opencv版本4.5.5
我尝试执行这个程序:https://raw.githubusercontent.com/ageitgey/face_recognition/master/examples/facerec_from_webcam.py
通过运行:python3facerec_from_webcam.py
网络摄像头启动,然后立即停止,程序崩溃
我有这个错误:
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "/home/stacy/.local/lib/python3.10/site-packages/cv2/qt/plugins"
Traceback (most recent call last):
File "/home/stacy/facerec_from_webcam_faster.py", line 55, in <module>
face_encodings = face_recognition.face_encodings(rgb_small_frame, face_locations)
File "/home/stacy/.local/lib/python3.10/site-packages/face_recognition/api.py", line 214, in face_encodings
return [np.array(face_encoder.compute_face_descriptor(face_image, raw_landmark_set, num_jitters)) for raw_landmark_set in raw_landmarks]
File "/home/stacy/.local/lib/python3.10/site-packages/face_recognition/api.py", line 214, in <listcomp>
return [np.array(face_encoder.compute_face_descriptor(face_image, raw_landmark_set, num_jitters)) for raw_landmark_set in raw_landmarks]
TypeError: compute_face_descriptor(): incompatible function arguments. The following argument types are supported:
1. (self: _dlib_pybind11.face_recognition_model_v1, img: numpy.ndarray[(rows,cols,3),numpy.uint8], face: _dlib_pybind11.full_object_detection, num_jitters: int = 0, padding: float = 0.25) -> _dlib_pybind11.vector
2. (self: _dlib_pybind11.face_recognition_model_v1, img: numpy.ndarray[(rows,cols,3),numpy.uint8], num_jitters: int = 0) -> _dlib_pybind11.vector
3. (self: _dlib_pybind11.face_recognition_model_v1, img: numpy.ndarray[(rows,cols,3),numpy.uint8], faces: _dlib_pybind11.full_object_detections, num_jitters: int = 0, padding: float = 0.25) -> _dlib_pybind11.vectors
4. (self: _dlib_pybind11.face_recognition_model_v1, batch_img: List[numpy.ndarray[(rows,cols,3),numpy.uint8]], batch_faces: List[_dlib_pybind11.full_object_detections], num_jitters: int = 0, padding: float = 0.25) -> _dlib_pybind11.vectorss
5. (self: _dlib_pybind11.face_recognition_model_v1, batch_img: List[numpy.ndarray[(rows,cols,3),numpy.uint8]], num_jitters: int = 0) -> _dlib_pybind11.vectors
Invoked with: <_dlib_pybind11.face_recognition_model_v1 object at 0x7fd0a822a430>, array([[[163, 141, 133],
[164, 138, 133],
[167, 139, 131],
...,
[172, 152, 148],
[174, 147, 152],
[174, 148, 148]],
[[166, 140, 135],
[166, 141, 135],
[165, 141, 130],
...,
[172, 152, 152],
[172, 151, 149],
[171, 153, 146]],
[[166, 143, 136],
[163, 143, 131],
[161, 144, 131],
...,
[175, 155, 156],
[171, 152, 151],
[169, 153, 150]],
...,
[[168, 167, 166],
[ 5, 12, 21],
[ 11, 19, 24],
...,
[176, 125, 90],
[168, 132, 114],
[166, 163, 165]],
[[132, 146, 152],
[ 14, 21, 34],
[ 15, 20, 23],
...,
[176, 126, 107],
[176, 157, 155],
[162, 162, 165]],
[[ 22, 37, 64],
[ 19, 23, 37],
[ 18, 20, 27],
...,
[ 65, 54, 84],
[169, 180, 202],
[145, 156, 166]]], dtype=uint8), <_dlib_pybind11.full_object_detection object at 0x7fd0a8231af0>, 1
我尝试删除这一行:face_encodings =face_recognition.face_encodings(rgb_small_frame,face_locations)。
程序不会崩溃,但无法识别网络摄像头中的人脸。
有人知道问题是什么以及我该如何解决它吗?
你能解决这个错误吗