我在我的Ubuntu 14.04系统系统上安装了opencv
pip install python-opencv
我的Python版本是2.7.14
import cv2
cv2.__version__
告诉我,我有OpenCV版本3.4.0。
之后我想按照OpenCV网站上的教程进行操作
import numpy as np
import cv2 as cv
img = cv.imread('messi5.jpg',0)
print img
它一直工作到这一点,但后来我应该进入
cv.imshow('image',img)
我收到以下错误:
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
有谁知道问题是什么?
尝试检查您正在阅读的图像是否正在加载
image = cv2.imread(filepath,0) #0 for gray scale
if image is None:
print "Cant Load Image"
else:
cv2.imshow("Image", image)
cv2.waitKey(0)
显然地
pip install python-opencv
根本不工作,不应该使用。我从他们的网站安装Opencv后就可以了