【pyqt5学习】——graphicView显示opencv图像
生活随笔
收集整理的這篇文章主要介紹了
【pyqt5学习】——graphicView显示opencv图像
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
imgpath = "result.jpg"img = cv2.imread(imgpath) # 讀取圖像img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) # 轉(zhuǎn)換圖像通道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) # 創(chuàng)建像素圖元self.item.setScale(self.zoomscale)self.scene = QGraphicsScene() # 創(chuàng)建場景self.scene.addItem(self.item)self.graphicsView.setScene(self.scene) # 將場景添加至視圖
總結(jié)
以上是生活随笔為你收集整理的【pyqt5学习】——graphicView显示opencv图像的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux uvc协议_linux 使用
- 下一篇: solr的一些查询语法