openCV:该函数未实现

时间:2017-05-02 13:56:33

标签: python opencv centos

尝试运行python脚本并抛出以下错误:

OpenCV Error: Unspecified error (The function is not implemented. Rebuild the
 library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or 
 Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure
 script) in cvDestroyAllWindows, file /io/opencv/modules/highgui
 /src/window.cpp, line 577
Traceback (most recent call last):
  File "/home/ldsvm/PycharmProjects/tagging/C1_DrawBboxesOnImages.py", line 
  116, in <module> cv2.destroyAllWindows()
cv2.error: /io/opencv/modules/highgui/src/window.cpp:577: error: (-2) The 
 function is not implemented. Rebuild the library with Windows, GTK+ 2.x or 
 Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and 
 pkg-config, then re-run cmake or configure script in function  
 cvDestroyAllWindows

我已经安装了libgtk2.0-devpkg-config并重新安装了opencv3,但仍然遇到了相同的错误。

我在CentOS上。

1 个答案:

答案 0 :(得分:0)

最简单的方法是删除opencv软件包以更新conda,然后使用第三个命令查找丢失的软件包。

conda remove opencv
conda update conda
conda install --channel menpo opencv

另一个选择是使用 matplotlib 代替使用opencv内置函数。...

import cv2
import matplotlib.pyplot as plt

img = cv2.imread('img.jpg',0)

plt.imshow(img, cmap='gray')
plt.show()