linux opencv gtk 没窗口,OpenCV GTK+2.x error

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

问题:

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.

6c1555302777729326ca3efa0910d9ec.png

回答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");

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/565315.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

硬盘分区

我们买回一台全新的笔记本的时候,我们会发现里面只有一个硬盘,这个时候为了满足我们的需求我们往往要对硬盘进行分区,那麽如何正确的对硬盘进行分区的呢? 下面教大家如何正确的对电脑硬盘进行分区操作。 操作方法 1、在桌面上找…

python入门:Anaconda和Jupyter notebook的安装与使用

文章目录 一、安装和使用Anaconda 1、anaconda是什么? 2、为什么需要安装anaconda? 3、如何安装anaconda? 通过官网下载页面 开源软件下载 安装步骤: 4、jupyter汉化 5、如何管理包? 1.列出已安装的包 2.安装…

非线性规划(1)

目录 一、非线性规划的定义 二、非线性规划的模型 三、非线性规划函数 四、线性不等式约束 五、线性不等式和等式约束 六、带有非线性约束的求最值 七、非线性约束 总结: 一、非线性规划的定义 前面我们学了线性规划,整数规划,我们可…

响应式布局Demo

顾名思义&#xff0c;响应式布局就是为适应不同终端而形成的一种技术。我总结了一个简单的例子帮助大家了解和学习响应式布局。 实现响应式布局的几种方式&#xff1a;媒体查询、JS、流体布局、弹性布局… 常用的meta标签 <meta content"widthdevice-width,initial-…

整数线性规划实现(lingo,python分枝界定法)

本文章为上篇建模学习打卡第二天的续 文章目录 一、本次问题 二、本题理解 三、问题求解 1.lingo实现 &#xff08;1&#xff09;先抛除整数约束条件对问题求解 &#xff08;2&#xff09;加入整数约束条件求解 2.python实现求解 &#xff08;1&#xff09;先抛除整数约…

Atmel跑Linux的arm芯片,Linux已被移植到Atmel的ATmega微控制器

Ubuntu Linux发行版已经被移植到最便宜、最便携的平台中&#xff1a;一个Atmel的ATmega微控制器。拥有一个20MHz的8位AVR处理器&#xff0c;128KB的闪存和整块16KB的SRAM&#xff0c;ATmega1284P并不是建立微型计算机最合乎逻辑的选择。它是在Arduino原型平台中找到的同样基础的…

Android Studio 详细安装教程

在我们的日常 Android 开发中&#xff0c;一个好的开发工具是必不可少的------Android Studio&#xff0c;是一个最重要的开发工具。 下面我将详细介绍Android Studio的下载安装。 一、安装环境及下载资源 1.1 安装环境 电脑系统 : Windows 10 JDK 版本 : 1.8 Android Stud…

零基础爬虫requests初阶教程,手把手教你爬数据

目录 一、环境与工具 二、学爬虫必备知识 三、简单体验 requests 四、get 请求 3.1 基础讲解一 3.3 基础讲解二 3.2 基础讲解三 3.4 获取cookie 3.5 获取请求头 3.6 添加请求头 3.5 知乎爬取反扒技术 3.6 抓取二进制数据 3.7 美女私房照爬取&#xff08; 准备发车…

vsftpd的主配置文件是什么linux,vsftpd.conf配置文件详解

vsftpd.conf配置文件详解# 是否允许匿名用户登录。默认值为YES。anonymousYES|NO# 是否允许匿名用户上传文件(如果设置为YES&#xff0c;则write_enable也必须设置为YES)。默认值为NO。anon_upload_enableYES|NO# 是否允许匿名用户创建目录(如果设置为YES&#xff0c;则write_e…

【youcans 的图像处理学习课】11. 形态学图像处理(上)

专栏地址&#xff1a;『youcans 的图像处理学习课』 文章目录&#xff1a;『youcans 的图像处理学习课 - 总目录』 【youcans 的图像处理学习课】11. 形态学图像处理&#xff08;上&#xff09; 【youcans 的图像处理学习课】11. 形态学图像处理&#xff08;中&#xff09; 【y…

Android Sdk 安装配置

在我们安装了Android Studio之后&#xff0c;我们发现不能使用&#xff0c;因为缺少一个Sdk的配置&#xff0c;下面就给大家详细介绍一下Sdk的配置。 打开我们的Android Studio。 选择Do not import settinge&#xff0c;然后点击OK。 点击 Cancel 退出即可&#xff0c;后面…

爬虫requests高阶篇详细教程

文章目录 一、前言 二、SSL验证 三、代理设置 四、超时设置 ​ 五、身份认证 1&#xff09;基本身份认证 2&#xff09;摘要式身份认证 六、总结 一、前言 本篇文高阶篇&#xff0c;上一篇为基础篇&#xff0c;希望你一定要学完基础再来看高阶篇内容 基础篇文章可以看大…

Android Studio 创建第一个项目应用

选择打开"Start a new Android Studio project"&#xff0c;新建一个Android项目。 选择一个空白的Activity&#xff0c;然后点击Next。 修改相应Android项目的名称、包名、项目位置等&#xff0c;以符合项目要求&#xff0c;点击Finish。 第一次创建项目可能会这样…

主成分分析(PCA)及其可视化——matlab

本文所用为matlab2016a matlab安装&#xff1a;待更新 matlab基础知识&#xff1a;待更新 如果本文内容已学会&#xff0c;可以看看python的哦 主成分分析&#xff08;PCA&#xff09;及其可视化——python_菜菜笨小孩的博客-CSDN博客 文章目录 一、主成分分析的原理 二…

Android studio真机调试

在我们进行Android开发的时候&#xff0c;调试这个环节是必不可少的也是至关重要的&#xff0c;使用真机调试可以更加准确清晰的显示效果。 真机调试Android应用 1.用数据线将手机连接到电脑&#xff0c;打开手机的开发者选项。 由于各个手机厂商的打开方式都不同&#xff0…

主成分分析(PCA)及其可视化——python

可以看看这个哦python入门&#xff1a;Anaconda和Jupyter notebook的安装与使用_菜菜笨小孩的博客-CSDN博客 如果你学会了python 可以看看matlab的哦 主成分分析&#xff08;PCA&#xff09;及其可视化——matlab_菜菜笨小孩的博客-CSDN博客 目录 一、主成分分析的原理 二…

Emulator: PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT

我们安装完毕Android Studio之后&#xff0c;创建第一个项目&#xff0c;我们想要使用模拟器进行运行&#xff0c;但是当我们启动模拟器的时候却发现无法启动&#xff0c;而且出现了错误信息。 首先我们要知道错误信息是什么&#xff1f; 提示信息的意思是说“avd系统路径找不…

多元线性回归模型-数学建模类-matlab详解

如果本文有点小难理解的话&#xff0c;可以看看我之前的基础线性规划啥的&#xff0c;有lingo&#xff0c;matlab还有python 就不给大家放链接了&#xff0c;想看的话&#xff0c;点击头像即可&#xff01;&#xff01; 文章目录 &#xff08;1&#xff09;一元线性回归之旧…

手把手教你爬虫requests实战演练——python篇

文章目录 一、前言 二、实战 1&#xff09;获取百度网页并打印 2&#xff09;获取帅哥图片并下载到本地 4) 获取美女视频并下载到本地 5&#xff09;搜狗关键词搜索爬取 6&#xff09;爬取百度翻译 7&#xff09;爬取豆瓣电影榜单 8&#xff09;JK妹子爬取 总结&#xff…

Android studio 3.x 安装genymotion插件

在日常的Android开发中&#xff0c;模拟器是必不可少的&#xff0c;下面就给大家讲解一下如何在Android studio 3.x 安装genymotion插件。 对于Android studio 3.x之前的版本&#xff0c;可以直接在插件那里在线安装genymotion插件。 Android studio 3.0版本之后就搜索不到了…