代码拉取完成,页面将自动刷新
import multiprocessing
import sys
import time
import queue
from PyQt5 import QtWidgets
from UI import Ui_MainWindow
from Emit_Image import ThreadEmitImage
class MyMainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
def __init__(self):
super(MyMainWindow, self).__init__()
self.setupUi(self)
self.initUI()
self.my_thread_queue_image_done = queue.PriorityQueue()
self.my_thread_queue_image_read = queue.PriorityQueue()
self.my_process_queue_image_processing = multiprocessing.Queue()
self.my_process_queue_image_processed = multiprocessing.Queue()
self.my_end = multiprocessing.Queue()
self.my_thread = ThreadEmitImage(self.my_thread_queue_image_done, self.my_thread_queue_image_read,
self.my_process_queue_image_processing, self.my_process_queue_image_processed,
self.my_end)
self.my_thread.my_signal_image.connect(self.show_image)
self.pushButton.clicked.connect(self.my_start)
self.last_time = time.time()
def initUI(self):
self.setWindowTitle("Video")
self.setFixedSize(self.width(), self.height())
def show_image(self, image):
this_time = time.time()
last_time = self.last_time
self.last_time = this_time
try:
self.label_fps.setText(str(1 / (this_time - last_time)))
# print(str(1 / (this_time - last_time)))
except:
pass
self.label.setPixmap(image[0])
def my_start(self):
self.my_thread.start()
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
MyUI = MyMainWindow()
MyUI.show()
sys.exit(app.exec_())
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。