Accessing the camera

To access the camera when it is supported by the hardware and Qt Multimedia, use the Camera type and its associated types to control the camera's capture behavior, exposure, flash, focus, and image processing settings. A simple use of the camera to show a viewfinder looks like the following code:

import QtQuick 2.3
import QtMultimedia 5.0

Item {
    width: 640
    height: 480

    Camera {
        id: camera
    }

    VideoOutput {
        source: camera
        anchors.fill: parent
    }
}

In short, the Camera type acts like a source for the video just as a MediaPlayer instance does.

The Camera type provides a few properties to control its behavior. They are:

  • imageCapture: This is an instance of CameraCapture, which defines how the camera should capture an image
  • videoRecording ...

Get Application Development with Qt Creator - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.