Ejemplo n.º 1
0
 def __init__(self):
     super(MainWindow,self).__init__()
     self.ui = loadUi(os.path.join(THIS_DIR, 'mainwindow.ui'), self)
     self.thread = QThread()
     try:
         self.camera = CameraDevice()
     except ValueError:
         self.ui.video.setText("Device not found!\n\nIs FFMPEG available?")
     else:
         self.camera.frame_ready.connect(self.update_video_label)
         self.ui.video.setMinimumSize(*self.camera.size)
         self.camera.moveToThread(self.thread)
Ejemplo n.º 2
0
    def __init__(self):
        super(MainWindow, self).__init__()
        self.recognizer = Recognizer()
        self.recognizer.learn()
        self.ui = loadUi(os.path.join(THIS_DIR, 'mainwindow.ui'), self)
        self.thread = QThread()
        try:
            self.camera = CameraDevice()
        except ValueError:
            self.ui.video.setText("Device not found!\n\nIs FFMPEG available?")
        else:
            self.camera.frame_ready.connect(self.update_video_label)
            self.ui.video.setMinimumSize(640 * 2, 480)
            self.camera.moveToThread(self.thread)

        self.ui.t_max.setValue(0)
        self.ui.t_min.setValue(255)
        self.ui.s_max.setValue(200)
        self.ui.s_min.setValue(3)
        self.update_values()
Ejemplo n.º 3
0
    app = web.Application(middlewares=auth)
    app.on_shutdown.append(on_shutdown)
    app.router.add_get('/', server.index)
    app.router.add_get('/favicon.png', server.favicon)
    app.router.add_get('/balena-logo.svg', server.balena_logo)
    app.router.add_get('/balena-cam.svg', server.balena)
    app.router.add_get('/client.js', server.javascript)
    app.router.add_get('/style.css', server.stylesheet)
    app.router.add_post('/offer', offer)
    app.router.add_get('/mjpeg', mjpeg_handler)
    app.router.add_get('/ice-config', config)

    web.run_app(app, access_log=None, port=80)


pcs = set()

# open media source
if "CAMERA" in os.environ:
    checkDeviceReadiness()
    #Load Camera based on environment variable, default to /dev/video0
    player = CameraDevice(int(os.getenv('CAMERA', 0)))
else:
    player = CameraDevice("/usr/src/video/construction.mp4")

# Factory to create peerConnections depending on the iceServers set by user
pc_factory = PeerConnectionFactory()

if __name__ == '__main__':
    main()