当我像这样使用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。刚刚编辑了编程部分代码。感谢stackoverflow反馈
答案 0 :(得分:0)
我猜你用Cmake自己构建了OpenCV lib?然后你忘了打开一些必要的标志(显然是GTK支持)。您必须在启用了正确的编译器标志的情况下重建lib。为了帮助您实现这一目标,OpenCV官方网站上有一个python的“入门”页面。