当我像这样使用cv2.imshow
时:
import numpy as np
import cv2
img = cv2.imread('galaxy.jpg',0)
cv2.imshow('image',img)
我得到以下错误:
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 cvShowImage, file -------src-dir-------/opencv-2.4.10/modules/highgui/src/window.cpp, line 501
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
cv2.error: -------src-dir-------/opencv-2.4.10/modules/highgui/src/window.cpp:501: 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 cvShowImage
p.S.刚刚编辑了编程部件代码。由于堆叠气流反馈
我猜您自己使用Cmake构建了OpenCV库?然后你忘记打开一些必要的标志(显然是GTK支持)。您必须在启用了正确的编译器标志的情况下重新生成lib。为了帮助你做到这一点,OpenCV官方网站上有一个python的"入门"页面。