QCameraDevice#
The QCameraDevice
class provides general information about camera devices. More…
Synopsis#
Functions#
def
__eq__
(other)def
__ne__
(other)def
description
()def
id
()def
isDefault
()def
isNull
()def
photoResolutions
()def
position
()def
videoFormats
()
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
- class PySide6.QtMultimedia.QCameraDevice#
PySide6.QtMultimedia.QCameraDevice(other)
- Parameters
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
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
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
- Return type
bool
Returns true if this QCameraDevice
is different from other
.
- PySide6.QtMultimedia.QCameraDevice.__eq__(other)#
- Parameters
- 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
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.