6/22/2023 0 Comments Qpixmap pyqt5# connect its signal to the update_image slot self. display_height = 480 # create the label that holds the image self. QtCore import pyqtSignal, pyqtSlot, Qt, QThread import numpy as np class VideoThread( QThread):Ĭhange_pixmap_signal = pyqtSignal( np. QtGui import QPixmap import sys import cv2 from PyQt5. ![]() ![]() QtWidgets import QWidget, QApplication, QLabel, QVBoxLayout from PyQt5. Here is an exampleįrom PyQt5 import QtGui from PyQt5. To do this load the image with cv2.imread and then we convert this to a QPixmap and rescale. Well we could us Qt to load the image directly, but I want to do this with opencv so it can be integrated into a computer vision app. # set the image image to the grey pixmap self. # create a grey pixmap grey = QPixmap( width, height) # set the vbox layout as the widgets layout self. # create a vertical box layout and add the two labels vbox = QVBoxLayout() Width = 640 height = 480 # create the label that holds the image self. QtGui import QPixmap, QColor import sys class App( QWidget):
0 Comments
Leave a Reply. |