Python OpenCV imshow失败 [英] Python OpenCV imshow fails

查看:406
本文介绍了Python OpenCV imshow失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu 14.04系统系统上使用以下方式安装了opencv

I installed opencv on my Ubuntu 14.04 system system with

pip install python-opencv

我的Python版本是2.7.14

my Python version is 2.7.14

import cv2
cv2.__version__

告诉我我具有OpenCV版本3.4.0.

tells me that I have the OpenCV version 3.4.0.

之后,我想按照OpenCV网站上的教程进行操作

After that I wanted to follow the tutorial on the OpenCV website

import numpy as np
import cv2 as cv
img = cv.imread('messi5.jpg',0)
print img

到现在为止一切正常,但是我应该输入

It works fine until this point, but then I am supposed to enter

cv.imshow('image',img)

,我收到以下错误消息:

and I get the following error:

QObject::moveToThread: Current thread (0x233cdb0) is not the object's thread (0x2458430).
Cannot move to target thread (0x233cdb0)

QObject::moveToThread: Current thread (0x233cdb0) is not the object's thread (0x2458430).
Cannot move to target thread (0x233cdb0)

QPixmap: Must construct a QApplication before a QPaintDevice

有人知道是什么问题吗?

Does anyone know what the problem is?

推荐答案

显然

pip install python-opencv

根本不起作用,不应使用.在我从他们的网站安装Opencv之后,它就起作用了

is not working at all and should not be used. After I installed Opencv from their website it worked

这篇关于Python OpenCV imshow失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆