QCameraInfoclass provides general information about camera devices. 更多 …
def
__eq__
(other)
def
__ne__
(other)
def
description
()
def
deviceName
()
def
isNull
()
def
orientation
()
def
position
()
def
availableCameras
([position=QCamera.UnspecifiedPosition])
def
defaultCamera
()
QCameraInfolets you query for camera devices that are currently available on the system.静态函数
defaultCamera()andavailableCameras()provide you a list of all available cameras.This example prints the name of all available cameras:
const QList<QCameraInfo> cameras = QCameraInfo::availableCameras(); for (const QCameraInfo &cameraInfo : cameras) qDebug() << cameraInfo.deviceName();A
QCameraInfocan be used to construct aQCamera. The following example instantiates aQCamerawhose camera device is named ‘mycamera’:const QList<QCameraInfo> cameras = QCameraInfo::availableCameras(); for (const QCameraInfo &cameraInfo : cameras) { if (cameraInfo.deviceName() == "mycamera") camera = new QCamera(cameraInfo); }还可以使用
QCameraInfoto get general information about a camera device such as description, physical position on the system, or camera sensor orientation.QCamera myCamera; QCameraInfo cameraInfo(myCamera); if (cameraInfo.position() == QCamera::FrontFace) qDebug() << "The camera is on the front face of the hardware system."; else if (cameraInfo.position() == QCamera::BackFace) qDebug() << "The camera is on the back face of the hardware system."; qDebug() << "The camera sensor orientation is " << cameraInfo.orientation() << " degrees.";另请参阅
QCameraInfo
(
[
name=QByteArray()
]
)
¶
QCameraInfo(camera)
QCameraInfo(other)
camera
–
QCamera
name
–
QByteArray
other
–
QCameraInfo
PySide2.QtMultimedia.QCameraInfo.
availableCameras
(
[
position=QCamera.UnspecifiedPosition
]
)
¶
position
–
Position
Returns a list of available cameras on the system which are located at
position
.
若
position
is not specified or if the value is
UnspecifiedPosition
, a list of all available cameras will be returned.
PySide2.QtMultimedia.QCameraInfo.
defaultCamera
(
)
¶
Returns the default camera on the system.
The returned object should be checked using
isNull()
before being used, in case there is no default camera or no cameras at all.
另请参阅
PySide2.QtMultimedia.QCameraInfo.
description
(
)
¶
unicode
Returns the human-readable description of the camera.
PySide2.QtMultimedia.QCameraInfo.
deviceName
(
)
¶
unicode
Returns the device name of the camera
This is a unique ID to identify the camera and may not be human-readable.
PySide2.QtMultimedia.QCameraInfo.
isNull
(
)
¶
bool
返回 true,若此
QCameraInfo
is null or invalid.
PySide2.QtMultimedia.QCameraInfo.
__ne__
(
other
)
¶
other
–
QCameraInfo
bool
返回 true,若此
QCameraInfo
is different from
other
.
PySide2.QtMultimedia.QCameraInfo.
__eq__
(
other
)
¶
other
–
QCameraInfo
bool
返回 true,若此
QCameraInfo
等于
other
.
PySide2.QtMultimedia.QCameraInfo.
orientation
(
)
¶
int
Returns the physical orientation of the camera sensor.
The value is the orientation angle (clockwise, in steps of 90 degrees) of the camera sensor in relation to the display in its natural orientation.
You can show the camera image in the correct orientation by rotating it by this value in the anti-clockwise direction.
For example, suppose a mobile device which is naturally in portrait orientation. The back-facing camera is mounted in landscape. If the top side of the camera sensor is aligned with the right edge of the screen in natural orientation, the value should be 270. If the top side of a front-facing camera sensor is aligned with the right of the screen, the value should be 90.
PySide2.QtMultimedia.QCameraInfo.
position
(
)
¶
Position
Returns the physical position of the camera on the hardware system.