imgpath = "result.jpg"img = cv2.imread(imgpath) # 读取图像img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) # 转换图像通道x = img.shape[1] # 获取图像大小y = img.shape[0]self.zoomscale = 1 # 图片放缩尺度frame = QImage(img, x, y, x * 3, QImage.Format_RGB888)pix = QPixmap.fromImage(frame)self.item = QGraphicsPixmapItem(pix) # 创建像素图元self.item.setScale(self.zoomscale)self.scene = QGraphicsScene() # 创建场景self.scene.addItem(self.item)self.graphicsView.setScene(self.scene) # 将场景添加至视图