def MatToQImage(mat,swapped=True):
'''?numpy.ndarray???QtGui.QImage?????QPixmap?????QLabel???'''
height, width = mat.shape[:2]
dim = 1 if mat.ndim == 2 else mat.shape[2]
bytesPerLine = dim * width
# ?numpy.ndarray???QtGui.QImage????????
qimage = QtGui.QImage(mat.data, width, height, bytesPerLine, QtGui.QImage.Format_RGB888)
if swapped:
qimage = qimage.rgbSwapped()
return qimage
#return QPixmap.fromImage(qimg)
评论列表
文章目录