Camera — Kivy v1.0.1-dev documentation

# Camera

This widget can be used to capture and display the camera on the screen. Once the widget is created, the texture inside the widget will be automatically updated.

    cam = Camera()

The actual implementation use our `CameraBase` implementation. The camera used is the first one found on your system. If you want to test another camera, you can select another index.

    cam = Camera(index=1)

You can also select the camera resolution.

    cam = Camera(resolution=(320, 240))

Warning

The camera texture is not updated as soon as you have created the object. The camera initialization is asynchronous, it may take a little bit before the texture is created.

class `kivy.uix.camera.` `Camera`(**kwargs)

  Bases: `kivy.uix.image.Image`

  Camera class. See module documentation for more informations.

  `index`

    Index of the used camera, starting from 0.

    `index` is a `NumericProperty`, default to -1 to allow auto selection.

  `play`

    Boolean indicate if the camera is playing. You can start/stop the camera by setting this property.

        # start the camera playing at creation
        video = Camera(source='movie.mkv', play=True)

        # create the camera, and start later
        video = Camera(source='movie.mkv')
        # and later
        video.play = True

    `play` is a `BooleanProperty`, default to True.

  `resolution`

    Prefered resolution to use when invoking the camera. If you are using [-1, -1], the resolution will be the default one.

        # create a camera object with the best image available
        cam = Camera()

        # create a camera object with an image of 320x240 if possible
        cam = Camera(resolution=(320, 240))

    Warning

    Depending of the implementation, the camera may not respect this property.

    `resolution` is a `ListProperty`, default to [-1, -1]