当前位置: 首页 > 知识库问答 >
问题:

Python Opencv imshow错误

云英才
2023-03-14

cmake-d cmake_build_type=release-d cmake_install_prefix=/usr/local-d with_tbb=on-d build_new_python_support=on-d with_v4l=on-d install_c_examples=on-d install_python_examples=on-d build_examples=on-d with_qt=on-d with_gtk=on-d with_opengl=on。

如果我尝试python:

导入cv2

打印(CV2.版本)

3.2.0

import cv2
image = cv2.imread("/home/reigin/Pictures/games.jpg")
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
cv2.imshow("Over the Clouds", image)
cv2.imshow("Over the Clouds - gray", gray_image)
cv2.waitKey(0)
cv2.destroyAllWindows()
cv2.imshow("Over the Clouds", image)
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 /io/opencv/modules/highgui/src/window.cpp, line 583
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
cv2.error: /io/opencv/modules/highgui/src/window.cpp:583: 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
reigin@reigin-K43SA:~$ echo $PKG_CONFIG_PATH
/usr/local/lib/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig

忍不住:

opencv 3.0 python imshow错误

http://vinllen.com/solve-error-libgtk2-0-dev-and-pkg-config-when-install-opencv/

http://answers.opencv.org/question/57945/opencv-gui-with-gtk-2-solled/

https://askubuntu.com/questions/210210/pkg-config-path-environment-variable

谢谢大家的关注和帮助…

共有1个答案

丁善
2023-03-14

您可能使用了不支持GTK的pip opencv-python。python绑定必须来自OpenCV的构建。

检查/usr/local/lib/python2.7/site-packages/文件夹,并确保您有一个编译和安装opencv的cv2.so文件,并且您没有在dist-packages中使用来自PIP的opencv-python的包。

参见此处:http://www.pyimagesearch.com/2015/06/22/install-opencv-3-0-and-python-2-7-on-ubuntu/

这里是我的Cmake行,为安装做准备:

cmake-d cmake_build_type=release-d cmake_install_prefix=/usr/local-d with_tbb=on-d with_gtk=on-d with_v4l=on-d with_opengl=on-d with_cublas=on-dwith_qt=off-dcuda_nvcc_flags=“-d_force_inlines”.

请注意,这假设您已经通过sudo apt-get install libgtk2.0-dev安装了适当的libgtk。

这才是CMake要吐槽的:

--GUI:

--gtkglext:YES(ver 1.2.0)

--OpenGL支持:是(/usr/lib/x86_64-linux-gnu/libglu.so/usr/lib/x86_64-linux-gnu/libgl.so)

--VTK支持:是(版本6.2.0)

 类似资料:
  • 我正在尝试搜索亚马逊的产品广告,并使用botlenose来帮助我做到这一点。但是,我刚刚收到HTTP错误400。 其他一些重要信息: 我来自巴西,我的标签也来自亚马逊。这是个问题吗? 我确实检查了我的钥匙、秘密和标签,一切正常。我确实在StackOverflow上查看了其他一些问题,但对我来说没有任何效果。 当然,出于安全原因,我更改了密钥。 Traceback(最近一次调用最后一次):File"

  • 我有一个基于Spring Web model view controller(MVC)框架的项目。Spring Web模型-视图-控制器(MVC)框架的版本是3.2.8 我有这个控制器 这个URL一切正常:

  • 目前从Angular JS controller中,我试图将JSON数据发送到后端服务。但是我有400个错误的请求错误。 在Controller中,我试图通过http服务发送数据,如下所示:

  • 我得到了这个错误,有什么想法会导致它吗?我试图发送一个DTO,它有一个扩展抽象类的对象列表,我想这个问题可能是因为DTO中的列表,还是因为抽象类的子类?

  • 在月食中, ”org.apache.axis2。AxisFault:传输错误: 403错误:禁止”试图从svn检出项目时发生错误。我不能实现这个错误,因此我检查了从终端使用"svn-co"命令的项目。 但是,有趣的是,当我试图在Eclipse中运行应用程序时,在输入凭据(用户名和密码)并按下“登录”按钮之后,我又遇到了相同的错误。响应是JFrame上的无效用户名/密码,但凭据没有错误。这只发生在日

  • Errors 错误 Library routines must often return some sort of error indication to the caller. As mentioned earlier, Go’s multivalue return makes it easy to return a detailed error description alongside th

  • 本章概述了Google API错误模型,以及开发人员如何正确生成和处理错误的一般指南。 Google API使用简单的协议无关错误模型,这使我们能够在不同的API,API协议(如gRPC或HTTP)以及错误上下文(例如,异步,批处理或工作流错误)中获得一致的体验。 错误模型 错误模型在逻辑上由google.rpc.Status定义,当API发生错误时,返回一个Status实例给客户端。 以下代码段

  • 5.4. 错误 在Go中有一部分函数总是能成功的运行。比如strings.Contains和strconv.FormatBool函数,对各种可能的输入都做了良好的处理,使得运行时几乎不会失败,除非遇到灾难性的、不可预料的情况,比如运行时的内存溢出。导致这种错误的原因很复杂,难以处理,从错误中恢复的可能性也很低。 还有一部分函数只要输入的参数满足一定条件,也能保证运行成功。比如time.Date函数