opencv出错:error: (-213:The function/feature is not implemented) Unknown/unsupported array type

Python调用OpenCV,莫名其妙出现以下错误:

Traceback (most recent call last):
  File "./consite_faceid.py", line 293, in consite_faceid_post_action
    str_img = cv2.imencode('.jpg', img)[1].tostring()
error: OpenCV(3.4.5) /home/quantum6/gh-install-cuda9/opencv-3.4.5/modules/core/src/matrix_wrap.cpp:840: error: (-213:The function/feature is not implemented) Unknown/unsupported array type in function 'type'

(308, 'traceback.print_exc():', None)
(309, 'traceback.format_exc():\nTraceback (most recent call last):\n  File "./consite_faceid.py", line 293, in consite_faceid_post_action\n    str_img = cv2.imencode(\'.jpg\', img)[1].tostring()\nerror: OpenCV(3.4.5) /home/quantum6/gh-install-cuda9/opencv-3.4.5/modules/core/src/matrix_wrap.cpp:840: error: (-213:The function/feature is not implemented) Unknown/unsupported array type in function \'type\'\n\n')

反复编译了几次OpenCV,还是错误.

后来卸载OpenCV:

sudo pip uninstall opencv-python
sudo apt remove    python-opencv

再根据需要安装,总算没有这个错误,能够运行了.

你可能感兴趣的:(Python/PyCharm,图像/OpenCV)