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.安装…

arm linux sms,基于arm处理器的手机短消息加密系统 encryption system for sms based on arm.pdf...

基于arm处理器的手机短消息加密系统 encryption system for sms based on arm第 22卷 第 期 电子测量与仪器学报 Vol.22 No.224 - -200S年 月 JOURNAL OFELECTRONICMEASUREMENTANDINSTRUMENT 95基 于 ARM处理器 的手机短消息加密 系统杨浩森 刊世新 徐 继友电子科技大学计算机科…

前端开发中游览器的兼容问题总结

首先,为什么各种浏览器会产生兼容性问题? 产生这个问题的主要原因是市面上的浏览器的种类很多,但由于不同的浏览器的内核不一致,从而导致各个浏览器对网页的解析就产生了差异。 对于解决浏览器兼容性问题,我们要从三…

非线性规划(1)

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

北京化工大学通信工程linux,北京化工大学通信工程专业解读

通信工程专业1.专业的内涵是什么?它的未来怎样发展?通信工程与电子信息工程、电子信息科学与技术同属电子信息科学与工程类,学科基础理论基本相同,没有本质区别,且通信工程与电子信息工程的专业内涵相互交融&#xff0…

2021数维杯国际赛数学建模-A题思路-新冠疫情

本思路转载于数模孵化园 此大佬日常更新各种建模比赛的思路!! 先看赛题翻译 2020年初,新型冠状病毒疫情(或称COVID-19)在全球迅速蔓延。根据世 界卫生组织2021年7月31日的报告,新型冠状病毒疫情对人类的…

linux vim 到底,真的有(很多)linux大牛用vim写项目吗?

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼作为一名非程序员半吊子运维,很想问一个问题:真的有(很多)linux大牛用vim写项目吗?最近折腾自己的路由器,要在LEDE的luci框架里加个显示interface信息的模块。按照惯例ggl一下最后在s…

响应式布局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;希望你一定要学完基础再来看高阶篇内容 基础篇文章可以看大…

八进制转换成十进制c语言程序,C语言程序 十进制、八进制、十六进制的相互转化...

#include#includevoid main(){//***************************************// 把十进制转化为十六进制与八进制//***************************************int number1;printf("请输入一个十进制的数:\n");scanf("%d",&number1);printf("%s\n %X\n…

Android Studio 创建第一个项目应用

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

c语言教程我要自学网,超适合自学的C++基础视频_C++基础

教程列表&#xff1a;01_C基础课程的安排和需要持之以恒的学习态度02_简单的C程序helloworld03_用面向过程和面向对象方法求解圆形面积_类和对象的关系思考_传智扫地僧04_类中不写成员函数易犯错误模型05-易犯错误模型-为什么需要成员函数(补充资料)-传智扫地僧06_课堂答疑类中…