cv2.error: OpenCV(4.8.1) D:xxxerror: (-2:Unspecified error) The function is not implemented.报错

在用harries角点检测算法的过程中,遇到了这个报错:
 


cv2.error: OpenCV(4.8.1) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:1272: 

error: (-2:Unspecified error) The function is not implemented. Rebuild the library with 

Windows, GTK+ 2.x or Cocoa support. 

If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'

然后先问了一下gpt,gpt说 : 

cv2.error: OpenCV(4.8.1) D:xxxerror: (-2:Unspecified error) The function is not implemented.报错_第1张图片

 

我估计可能是版本问题,最后找到了这个链接  :

Link

那么要怎么解决呢?

执行下面命令即可 : 

This solution seems to work for a majority of users, but not all. If you are in this case, see the proposed answer by Sachin Mohan.

I had the exact same error using yolov5, on Windows 10. Reinstalling the library by typing

pip uninstall opencv-python 

then

pip install opencv-python

 后面就可以显示图像了;

你可能感兴趣的:(环境配置,python,opencv,人工智能,计算机视觉)