可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):

问题:

I had installed OpenCV following these steps ().

After trying to compile one examples,i got this error :

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 cvNamedWindow, file /home/nick/.Apps/opencv/modules/highgui/src/window.cpp, line 516

terminate called after throwing an instance of 'cv::Exception'

what(): /home/nick/.Apps/opencv/modules/highgui/src/window.cpp:516: 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 cvNamedWindow

CMakeLists.txt

cmake_minimum_required(VERSION 2.8.4)

project(threadTest)

find_package( OpenCV REQUIRED )

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -pthread")

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "/home/nick/ClionProjects/threadTest")

set(SOURCE_FILES main.cpp)

add_executable(threadTest ${SOURCE_FILES})

target_link_libraries( threadTest ${OpenCV_LIBS} )

How to solve it?

回答1:

First check whether libgtk2.0-dev is installed properly. If you have installed aptitude package manager, run the following:

sudo aptitude search libgtk2.0-dev

It should return like this:

i libgtk2.0-dev - development files for the GTK+ library

p libgtk2.0-dev:i386 - development files for the GTK+ library

You need to build the files once again.Locate your OpenCV folder. Create a new folder and name it as release. Enter into this folder. For example

cd /home/user_name/OpenCv

mkdir Release

cd Release

Now build using cmake with following command:

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 ..

Remember to put WITH_GTK=ON during cmake.

After this step enter the command,

make

sudo make install

This should resolve your problem.If you have broken dependencies for libgtk2.0-dev, then install a fresh copy of libgtk2.0-dev using aptitude.

sudo aptitude install libgtk2.0-dev

回答2:

If you installed OpenCV using the opencv-python pip package, be aware of the following note, taken from https://pypi.python.org/pypi/opencv-python

IMPORTANT NOTE

MacOS and Linux wheels have currently some limitations:

video related functionality is not supported (not compiled with FFmpeg)

for example cv2.imshow() will not work (not compiled with GTK+ 2.x or Carbon support)

Also note that to install from another source, first you must remove the opencv-python package

To install OpenCV in Ubuntu I followed this guide, and it worked perfectly fine:

http://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/

回答3:

In order to improve @Nic Szer's answer I want to explain how to fix this error on Mac OS in three simple steps.

Remove installed OpenCV version to avoid mess up later

pip3 uninstall opencv-python

Lower your python version to 3.5 (current version 3.6 has problems with conda which we will use to install OpenCV)

conda install python=3.5

Finally, use conda to install working version of OpenCV

conda install -c menpo opencv3

And then voila: OpenCV will start working on your Mac OS(Siera 10.12.4).

回答4:

@oxydron/Elliott Miller:

I have Ubuntu 16.04 LTS environment with gtk 3 pre installed.

I got the same error for Caffe build (master branch),

Try the following steps, may be it should work for you.

sudo apt-get install libgtk-3-dev

cmake .. (WITH_GTK=ON and other settings),

make

And bingo the error was gone... in my python caffe code

Please note:

The CMAKE configuration should reflect GTK+ 3.x instead of GTK+ 2.x

GUI:

-- QT: NO

-- GTK+ 3.x: YES (ver 3.18.9)

-- GThread : YES (ver 2.48.2)

-- GtkGlExt: NO

-- OpenGL support: NO

-- VTK support: NO

回答5:

I have the solved using Anaconda 3 installing on Ubuntu 16.04.

I have used pycharm editor for my python code.

I am using python 3.6 version.

I solved the issue using these processes.

IDEA: we need to install the package opencv-contrib-python package from the pycharm.

回答6:

For me (Arch Linux, Anaconda with Python 3.6), installing from the suggested channels menpo or loopbio did not change anything. My solution was to

install pkg-config (sudo pacman -Syu pkg-config),

remove opencv from the environment (conda remove opencv) and

re-install opencv from the conda-forge channel (conda install -c conda-forge opencv)

conda list now returns opencv 3.3.0 py36_blas_openblas_203 [blas_openblas] conda-forgeand all windows launched using cv2 are working fine.

回答7:

I have had to deal with this issue a couple of times, this is what has worked consistently thus far:

conda remove opencv

conda install -c menpo opencv

pip install --upgrade pip

pip install opencv-contrib-python

回答8:

I had the same problem, and fixed it by simply reinstalling opencv.

There is no need to uninstall it first.

回答9:

I tried several of the answers mentioned above the one that worked for me in ubuntu is mentioned in the following steps:

Firstly, remove the current opencv package that is installed in your system by typing in the following command in the terminal conda remove opencv.

If your python version is 3.6 or above then change it into the stable version which can be done by typing in conda install python=3.5.

Later on install the opencv package again by giving the following input in terminal conda install -c menpo opencv3

回答10:

In case what they mentioned above doesn't work, try:

pip install opencv-python

for python2, or

pip3 install opencv-python

for python3

回答11:

I was using windows OS . I have gone through many stuffs in order to sort this problem . At last i just reinstall the opencv and cmake and it worked without any error.

回答12:

I have fixed this issue by replacing

cvDestroyWindow("showImage");

by

cvDestroyWindow("ShowImage");

linux opencv gtk 没窗口,OpenCV GTK+2.x error相关推荐

  1. OpenCV ERROE **: 02:07:27.741:GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the ...

    OpenCV ERROE **: 02:07:27.741:GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same proce ...

  2. Linux gtk开发教程,使用GTK+和Glade快速开发Linux图形界面

    使用GTK+和Glade快速开发Linux图形界面 Glade , GTK , Linux , draft , 图形 * 使用 GTK+ 和 Glade 快速开发 Linux 图形界面 ** GTK+ ...

  3. Linux ubuntu 装openCV,Linux(ubuntu 16.04) 安装 opencv C++

    Linux(ubuntu 16.04) 安装 opencv C++ Linux(ubuntu 16.04) 安装 opencv C++ 参考文档: https://blog.csdn.net/qq_3 ...

  4. 【OpenCV】Linux 下用 g++ 编译 OpenCV 程序

    编译命令: g++ gaussianBlur.cpp -o test `pkg-config --cflags --libs opencv` 执行编译生成的可执行文件: ./test gaussian ...

  5. vs code linux opencv,ubuntu+vscode 测试运行opencv

    ubuntu+vscode 测试运行opencv ubuntu+vscode 测试运行opencv 之前再ubuntu配置好了opencv,今天测试运行一下. 1.创建一个文件夹opencv+test ...

  6. 没有安装opencv的linux系统上运行基于opencv,Linux环境下安装OpenCV

    我使用的是ubuntu10.04系统.其他系统可能有些命令会不同. 由于同学需要在ARM板上移植OPenCV,而我之前有在的经验,他就叫我帮手. 我就试下先在我的ubuntu上安装OpenCV.安装成 ...

  7. linux下QT工程调用opencv、libtorch,并用cmake编译,及其遇到的一些问题的解决方法

    linux下QT工程调用opencv.libtorch,并用cmake编译: 文章目录 一.新建QT工程 二.编写CMakeLists.txt文件 三.各个文件的内容如下: 1.mainwindow. ...

  8. 在mfc的图形控件嵌入opencv的图形窗口

    在mfc中要显示opencv的图形有以下办法: 1.Cvvimage 类里的函数 DrawPicToHDC( IplImage *img, UINT ID) .现在opencv 3.0已经丢弃了这个类 ...

  9. Gtk-ERROR : GTK+ 2.x symbols detected. Using GTK+2.x and GTK+3 in the same process is not support

    Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+3 in the same process is not support ...

最新文章

  1. 解决JS在url中传递参数时参数包含中文乱码的问题
  2. 菜鸟经验积累之JS运算
  3. 使用CURL调用接口[*示例*]
  4. salesforce 零基础学习(五十一)使用 Salesforce.com SOAP API 实现用户登录以及简单的增删改查(JAVA访问salesforce)...
  5. idea 代码格式化快捷方式
  6. 《自然语言处理简明教程》读书笔记:第二章 词汇自动处理
  7. ISP许可证是什么证?
  8. 短篇硬科幻小说《勾股:2.013》
  9. 【计算机图形学 】绘制椭圆 | OpenGL+鼠标交互
  10. [错误解决]centos中使用kubeadm方式搭建一个单master的K8S集群
  11. 为何iPad 2充电快 但用不了多久?
  12. 计算机安全模式win7,安全模式启动,教您Win7怎么进入安全模式
  13. 从“零”开始学习一下DCT
  14. html中word-wrap无效,使用word-wrap来防止文字溢出
  15. java设置页码_Java 添加页码到Word文档
  16. 面向AI 的数据生态系统
  17. 《定投十年财务自由》书中精髓:我们如何通过定投获得更高的收益?
  18. unity关于对其他脚本对象的修改
  19. “金字塔原理”-写作
  20. IEEE期刊/会议论文模板

热门文章

  1. 原始servlet+hibernate+struts2,从前台到后台的整个过程
  2. ECharts 联动效果
  3. mockjs语法规范、设置mockjs拦截响应时间、Mock.Random占位符生成随机数据
  4. jdk中提供的Collection、Collections、Collector、Collectors你分的清楚?
  5. MySQL 查询速度慢与性能差的原因与解决方法
  6. oracle数据库中索引会失效的几种情况
  7. c语言dfs算法全排列代码,c语言dfs解决全排列问题
  8. python 3.9.0a0_Python 3.9.0 稳定版发布
  9. 状态反射在体育运动中的作用_体育运动木地板时刻运行在最佳状态的秘诀
  10. 仅完成部分的readprocessmemory或write_王者荣耀:三种李小龙获取方式!无需完成任务、28号即可兑换...