文章目录
1、QImage
- 使用bytes数据创建图像,使用方法:
QImage(data, width, height, bytesperline, format)
''
data: 是图像的字节的数据
bytesperline: W*C, 是OpenCV中的ndarray的存储格式([H, W, C], 按[H, W*C]的二维矩阵村粗和),详见
format:QImage.Format_RGB888
''
- 例如:
image为RGB格式的ndarray
img = QImage(image.data, image.shape[1], image.shape[0], image.shape[1]*image.shape[2], QImage.Format_RGB888)
label.setPixmap(QPixmap.fromImage(img))