QLabel 显示opencv Mat
import cv2 from PyQt5.QtGui import QImage, QPixmap from PyQt5.QtWidgets import QLabel label = QLabel() # Load the image using OpenCV image = cv2.imread("path/to/image.png") # Convert the image to a QImage height, width, channel = image.shape bytesPerLine = 3 * width qImg = QImage(image.data, width, height, bytesPerLine, QImage.Format_RGB888) # Convert the QImage to a QPixmap and set it as the pixmap for the QLabel pixmap = QPixmap.fromImage(qImg) label.setPixmap(pixmap)
#########################
标签:pixmap,Mat,width,image,opencv,QImage,QLabel From: https://www.cnblogs.com/herd/p/17252712.html