首页 新闻 会员 周边 捐助

TypeError: fromBGR2QImage() missing 1 required positional argument: 'frame'

0
悬赏园豆:200 [已解决问题] 解决于 2020-03-27 08:32

Image.py

def fromBGR2QImage(self, frame):
height, width, bytesPerComponent = frame.shape
bytesPerLine = bytesPerComponent * width
# 变换彩色空间顺序
temp = frame
temp = cv2.cvtColor(temp, cv2.COLOR_BGR2RGB)
# 转为QImage对象
image = QtGui.QImage(temp.data, width, height, bytesPerLine, QtGui.QImage.Format_RGB888)
return image

Main.py

from Image import fromBGR2QImage
class Main():
def init(self, parnet = None):
super(Main, self).__init__()
self.cap = cv2.VideoCapture(0)
self.updateFrame()
def updateFrame(self):
ret, frame = self.cap.read()
image = fromBGR2QImage(self, frame) ##出错的地方

报错:
Traceback (most recent call last):
File "demo2.py", line 36, in updateFrame
image = fromBGR2QImage(frame)
TypeError: fromBGR2QImage() missing 1 required positional argument: 'frame'

上官幺樱花的主页 上官幺樱花 | 初学一级 | 园豆:24
提问于:2020-03-27 08:18
< >
分享
最佳答案
0

已解决。
def fromBGR2QImage(self, frame)
--->
def fromBGR2QImage(frame)

上官幺樱花 | 初学一级 |园豆:24 | 2020-03-27 08:31
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册