Xshell中使用openCV显示图片

Xshell中使用openCV显示图片

1. 问题描述

配置好opencv之后,试着运行了一下自己写的cpp代码,结果报错了,类似于:

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 “show.py”, line 19, in
cv2.imshow(“depth”, im_color)
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

总之就是无法显示图片。解决这个问题需要两步

2. 包的安装

错误提示中说需要安装libgtk2.0-dev and pkg-config(不过一般后者都安装过了):

sudo apt-get install libgtk2.0-dev pkg-config

安装之后openCV的包需要重新编译,找到openCV的文件夹下的build文件夹(详情可以参考openCV的安装步骤:https://blog.csdn.net/shaojie_45/article/details/117599542)

重新编译并安装

make -j8
sudo make install

之后这一步就完成了

3. Xmanager

Xshell中显示图片需要Xmanager。可惜Xmanager是收费的,推荐去某宝上找个靠谱的店下载一个,之后配置Xshell:
在这里插入图片描述
在这里插入图片描述
之后就可以正常显示窗口与图片了,如:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值