展开全部
可以,用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= np.ndarray(())
self.img3= np.ndarray(())
self.img4= np.ndarray(())
self.img4= np.empty([960,1280, 3], int)
self.cap = cv.VideoCapture(3) #注意,由大开到小,很重要
self.cap.set(3, 640) # setup the resolution of CCD
self.cap.set(4, 480)
ret, sel