展开全部
可以,用PYQT+CV2,四个USB连接成功,程序如下,UI要自62616964757a686964616fe4b893e5b19e31333431353937己搞了,放不下
# -*- coding: utf-8 -*-
import sys#, time
from PyQt5 import QtWidgets
from PyQt5.QtCore import QTimer, QThread, pyqtSignal
from Ui_cv2ui_thread import Ui_MainWindow
import cv2 as cv
from PyQt5.QtGui import QImage, QPixmap
from PyQt5.QtWidgets import (QApplication, QDialog, QFileDialog, QGridLayout,
QLabel, QPushButton, QColorDialog)
import numpy as np
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent=parent)
self.setupUi(self) #这个一定要在这个最前面位置
# define the slot for pushbutton to save the merged image
self.pushButton.clicked.connect(self.savemergeimage)
self.img = np.ndarray(()) #空的numpy array
self.img1 = np.ndarray(())
self.img2

使用PyQT和OpenCV,通过多线程实现同时调用和录像多个USB摄像头的功能。代码中定义了一个主窗口类,初始化时分别打开四个摄像头,并设置分辨率。每个摄像头的图像读取和显示都在独立的线程中进行,确保实时性和流畅性。
最低0.47元/天 解锁文章
4490

被折叠的 条评论
为什么被折叠?



