Ejemplo n.º 1
0
    def __init__(self):
        super().__init__()
        self.setWindowTitle('YOLOv5 Object Detection')
        self.setMinimumSize(1200, 800)

        GLOBAL.init_config()

        self.camera = WidgetCamera()  # 摄像头
        self.config = WidgetConfig()  # Yolo配置界面

        self.btn_camera = QPushButton('开启/关闭摄像头')  # 开启或关闭摄像头
        self.btn_camera.setFixedHeight(60)
        vbox1 = QVBoxLayout()
        vbox1.addWidget(self.config)
        vbox1.addStretch()
        vbox1.addWidget(self.btn_camera)

        self.btn_camera.clicked.connect(self.oc_camera)

        hbox = QHBoxLayout()
        hbox.addWidget(self.camera, 3)
        hbox.addLayout(vbox1, 1)

        vbox = QVBoxLayout()
        vbox.addLayout(hbox)

        self.central_widget = QWidget()
        self.central_widget.setLayout(vbox)

        self.setCentralWidget(self.central_widget)
        self.show()
Ejemplo n.º 2
0
    def __init__(self):
        super().__init__()
        self.setWindowTitle('YOLOv5 Object Detection')
        self.setMinimumSize(1200, 800)

        GLOBAL.init_config()

        self.camera1 = WidgetCamera('rtsp://*****:*****@192.168.0.65/', 1)
        self.camera2 = WidgetCamera('rtsp://*****:*****@192.168.0.66/', 2)
        self.camera3 = WidgetCamera('rtsp://*****:*****@192.168.0.67/', 3)
        self.camera4 = WidgetCamera('rtsp://*****:*****@192.168.0.68/',
                                    4)  # 摄像头
        self.config = WidgetConfig()  # Yolo配置界面

        self.btn_camera = QPushButton('开启/关闭摄像头')  # 开启或关闭摄像头
        self.btn_camera.setFixedHeight(60)
        vbox1 = QVBoxLayout()
        vbox1.addWidget(self.config)
        vbox1.addStretch()
        vbox1.addWidget(self.btn_camera)

        self.btn_camera.clicked.connect(self.oc_camera)
        hbox1 = QHBoxLayout()
        hbox1.addWidget(self.camera1)
        hbox1.addWidget(self.camera2)
        hbox2 = QHBoxLayout()
        hbox2.addWidget(self.camera3)
        hbox2.addWidget(self.camera4)

        vbox2 = QVBoxLayout()
        vbox2.addLayout(hbox1)
        vbox2.addLayout(hbox2)

        hbox = QHBoxLayout()
        hbox.addLayout(vbox2, 3)
        hbox.addLayout(vbox1, 1)

        vbox = QVBoxLayout()
        vbox.addLayout(hbox)

        self.central_widget = QWidget()
        self.central_widget.setLayout(vbox)

        self.setCentralWidget(self.central_widget)
        self.show()
        self.yolo = YOLO5()