コード例 #1
0
        # initialize the raspberry pi camera
        resolution = (arguments.width, arguments.height)
        picamera = PiCamera(resolution=resolution, framerate=arguments.fps)
        picamera.resolution = resolution
        picamera.annotate_background = Color('black')
        LOGGER.info('camera initialized with x={},y={},fps={}'.format(arguments.width, arguments.height, arguments.fps))

        # start the webserver
        LOGGER.info('setting up environment')
        mjpg_http_server = MjpegHttpServer(socket_port=8088, bind_address='0.0.0.0')
        mjpg_http_server.start()
        LOGGER.info('started webserver')

        # initialze the stuff processing the images from the mjpg
        image_source = ImageSource(**{'fps': arguments.fps, 'camera': picamera})
        LOGGER.info('started webcam process')
        mjpg_http_server.start_polling_images(image_source)

    except KeyboardInterrupt as e:
        LOGGER.info('got ctrl+c from user')
    except Exception as e:
        LOGGER.exception('caught an exception')
        traceback.print_exc()
    except ArgumentError as e:
        LOGGER.exception(e.message)
    finally:
        LOGGER.info('have a nice day')
        if mjpg_http_server is not None:
            mjpg_http_server.close()
コード例 #2
0
ファイル: Animator.py プロジェクト: SamuelEllertson/AutoAnim
 def __init__(self, args):
     self.args = args
     self.script_parser = ScriptParser(args)
     self.image_source = ImageSource(args)
     self.codec = cv2.VideoWriter_fourcc(*args.codec)