myQt.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:imagepyqt 作者: Image-Py 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号