QCameraDevice#

The QCameraDevice class provides general information about camera devices. More

Inheritance diagram of PySide6.QtMultimedia.QCameraDevice

Synopsis#

Functions#

Detailed Description#

QCameraDevice represents a physical camera device and its properties.

You can discover what cameras are available on a system using the availableCameras() and defaultCamera() functions. These are contained within QtMultimedia::MediaDevices.

This example prints the name of all available cameras:

cameras = QMediaDevices.videoInputs()
for cameraDevice in cameras:
    print(cameraDevice.description())

A QCameraDevice can be used to construct a QCamera . The following example instantiates a QCamera whose camera device is named mycamera:

cameras = QMediaDevices.videoInputs()
for cameraDevice in cameras:
    if cameraDevice.description() == "mycamera":
        camera = QCamera(cameraDevice)

You can also use QCameraDevice to get general information about a camera device such as description, physical position on the system, or camera sensor orientation.

myCamera = QCamera()
cameraDevice = camera.cameraDevice()
if cameraDevice.position() == QCameraDevice.FrontFace:
    print("The camera is on the front face of the hardware system.")
elif cameraDevice.position() == QCameraDevice.BackFace:
    print("The camera is on the back face of the hardware system.")
print("The camera sensor orientation is ", cameraDevice.orientation(), " degrees.")

See also

QCamera

class PySide6.QtMultimedia.QCameraDevice#

PySide6.QtMultimedia.QCameraDevice(other)

Parameters

otherPySide6.QtMultimedia.QCameraDevice

Constructs a null camera device

Constructs a copy of other.

PySide6.QtMultimedia.QCameraDevice.Position#

This enum specifies the physical position of the camera on the system hardware.

Constant

Description

QCameraDevice.UnspecifiedPosition

The camera position is unspecified or unknown.

QCameraDevice.BackFace

The camera is on the back face of the system hardware. For example on a mobile device, it means it is on the opposite side to that of the screen.

QCameraDevice.FrontFace

The camera is on the front face of the system hardware. For example on a mobile device, it means it is on the same side as that of the screen.

See also

position()

New in version 6.1.

PySide6.QtMultimedia.QCameraDevice.description()#
Return type

str

Returns the human-readable description of the camera.

Use this string to present the device to the user.

PySide6.QtMultimedia.QCameraDevice.id()#
Return type

PySide6.QtCore.QByteArray

Returns the device id of the camera

This is a unique ID to identify the camera and may not be human-readable.

PySide6.QtMultimedia.QCameraDevice.isDefault()#
Return type

bool

Returns true if this is the default camera device.

PySide6.QtMultimedia.QCameraDevice.isNull()#
Return type

bool

Returns true if this QCameraDevice is null or invalid.

PySide6.QtMultimedia.QCameraDevice.__ne__(other)#
Parameters

otherPySide6.QtMultimedia.QCameraDevice

Return type

bool

Returns true if this QCameraDevice is different from other.

PySide6.QtMultimedia.QCameraDevice.__eq__(other)#
Parameters

otherPySide6.QtMultimedia.QCameraDevice

Return type

bool

Returns true if this QCameraDevice is equal to other.

PySide6.QtMultimedia.QCameraDevice.photoResolutions()#
Return type

Returns a list of resolutions that the camera can use to capture still images.

See also

QImageCapture

PySide6.QtMultimedia.QCameraDevice.position()#
Return type

Position

Returns the physical position of the camera on the hardware system.

PySide6.QtMultimedia.QCameraDevice.videoFormats()#
Return type

Returns the video formats supported by the camera.