import time
from PySide6 import QtWidgets, QtGui, QtCore, QtOpenGLWidgets
from PySide6.QtGui import QOpenGLFunctions, QVector2D, QVector3D, QMatrix4x4
from PySide6.QtOpenGL import QOpenGLTexture, QOpenGLShader, QOpenGLShaderProgram
from PySide6.QtWidgets import QVBoxLayout
from pyqtgraph import ImageView
class VideoWidget(QtWidgets.QWidget):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored)
# self.setAlignment(QtCore.Qt.AlignCenter)
# 图像显示控件
self.graphicsView = ImageView(self)
# 隐藏直方图,菜单按钮,ROI
self.graphicsView.ui.histogram.hide()
self.graphicsView.ui.menuBtn.hide()
self.graphicsView.ui.roiBtn.hide()
self.verticalLayout = QVBoxLayout(self)
self.verticalLayout.addWidget(self.graphicsView)
# 设置窗口布局
self.setLayout(self.verticalLayout)
self.image_ = None
self.ori_image = None
if self.height() != 0:
self.des_w_h_ratio_ = self.width() / self.height()
self.src_w_h_ratio_ = float()
self.scale_w_ = int()
self.scale_h_ = int()
self.last = 0.0
self.texture = None
self.texCoords = []
self.vertices = []
self.vshader = None
self.vsrc = None
self.fshader = None
self.fsrc = None
self.program = None
pass
def set_image(self, image):
self.graphicsView.setImage(image)
pass
标签:None,self,pyqtgraph,graphicsView,QtWidgets,import,ImageView,VideoWidget,image
From: https://www.cnblogs.com/kk0716/p/16850007.html