QCameraDevice Class
QCameraDeviceクラスは、カメラ・デバイスに関する一般的な情報を提供します。詳細...
ヘッダ | #include <QCameraDevice> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Multimedia) target_link_libraries(mytarget PRIVATE Qt6::Multimedia) |
qmake: | QT += multimedia |
パブリックタイプ
enum | Position { UnspecifiedPosition, BackFace, FrontFace } |
プロパティ
|
|
公共機能
QCameraDevice() | |
QCameraDevice(const QCameraDevice &other) | |
~QCameraDevice() | |
QtVideo::Rotation | correctionAngle() const |
QString | description() const |
QByteArray | id() const |
bool | isDefault() const |
bool | isNull() const |
QList<QSize> | photoResolutions() const |
QCameraDevice::Position | position() const |
QList<QCameraFormat> | videoFormats() const |
bool | operator!=(const QCameraDevice &other) const |
QCameraDevice & | operator=(const QCameraDevice &other) |
bool | operator==(const QCameraDevice &other) const |
詳細説明
QCameraDeviceは、物理的なカメラデバイスとそのプロパティを表します。
availableCameras()関数とdefaultCamera()関数を使用して、システムで利用可能なカメラを検出できます。これらは QtMultimedia::MediaDevices に含まれています。
この例では、利用可能なすべてのカメラの名前を表示します:
constQList<QCameraDevice> カメラQMediaDevices::videoInputs();for(constQCameraDevicecameraDevice: cameras) qDebug() << cameraDevice.description();
QCameraDevice を使用して、QCamera を構築することができます。次の例では、カメラ・デバイスの名前がmycamera
であるQCamera をインスタンス化します:
const QList<QCameraDevice> cameras = QMediaDevices::videoInputs(); for (const QCameraDevice &cameraDevice : cameras) { if (cameraDevice.description() == "mycamera") camera = new QCamera(cameraDevice); }
QCameraDeviceを使用して、カメラ・デバイスの説明やシステム上の物理的な位置などの一般的な情報を取得することもできます。
QCameramyCamera;QCameraDevicecameraDevice= camera->cameraDevice();if(cameraDevice.position()== ::FrontFace) QCameraDevice::FrontFace) qDebug() << "The camera is on the front face of the hardware system."; else if(cameraDevice.position()==) QCameraDevice::BackFace) qDebug() << "The camera is on the back face of the hardware system.";
QCameraも参照 。
メンバー型ドキュメント
enum QCameraDevice::Position
この列挙型は、システムハードウェア上のカメラの物理的な位置を指定する。
定数 | 値 | 説明 |
---|---|---|
QCameraDevice::UnspecifiedPosition | 0 | カメラの位置は未定義または不明。 |
QCameraDevice::BackFace | 1 | カメラはシステムハードウェアの裏面にある。例えばモバイルデバイスの場合、画面の反対側にあることを意味します。 |
QCameraDevice::FrontFace | 2 | カメラがシステムハードウェアの前面にある。例えばモバイル機器では、画面と同じ側にあることを意味する。正面を向いたカメラは、プロパティQVideoFrame::mirrored をtrue に設定したビデオ・フレームを生成します。これは、これらのフレームの表示が垂直軸を中心に反転され、ビデオ出力がミラーとして表示されるのに対し、録画ではQVideoFrame::surfaceFormat で指定された表面の変形のみが考慮されることを意味します。 |
position()も参照 。
プロパティ・ドキュメンテーション
[read-only, since 6.7]
correctionAngle : const QtVideo::Rotation
カメラの物理的な回転を補正するために必要な回転角度を返します。言い換えると、このプロパティは、ネイティブの向きでデバイスの画面上に直立するために出力画像を回転させる必要がある時計回りの角度を表します。correctionAngle はネイティブの向きに対する相対的なものであるため、この値はデバイスの向き(ポートレート/ランドスケープ)を変えても変化しません。ネイティブの向きとカメラの向きがメーカーによって定義されている Android では、補正角度が 0 以外になることがあります。
このプロパティは Qt 6.7 で導入されました。
アクセス関数です:
QtVideo::Rotation | correctionAngle() const |
[read-only]
description : const QString
人間が読めるカメラの説明を返します。
この文字列を使用して、ユーザにデバイスを提示します。
アクセス関数:
QString | description() const |
[read-only]
id : const QByteArray
カメラのデバイスIDを返します。
これはカメラを識別するためのユニークなIDであり、人間が読めない場合があります。
アクセス関数:
QByteArray | id() const |
[read-only]
isDefault : const bool
このデバイスがデフォルトのカメラデバイスである場合、true を返します。
アクセス関数:
bool | isDefault() const |
[read-only]
position : const Position
ハードウェアシステム上のカメラの物理的な位置を返します。
アクセス関数:
QCameraDevice::Position | position() const |
[read-only]
videoFormats : const QList<QCameraFormat>
カメラがサポートしているビデオフォーマットを返します。
アクセス関数
QList<QCameraFormat> | videoFormats() const |
メンバー関数ドキュメント
QCameraDevice::QCameraDevice()
ヌル・カメラ・デバイスを構築する。
QCameraDevice::QCameraDevice(const QCameraDevice &other)
other のコピーを作成する。
[noexcept]
QCameraDevice::~QCameraDevice()
QCameraDevice を破壊する。
bool QCameraDevice::isNull() const
このQCameraDevice が null または無効な場合に true を返します。
QList<QSize> QCameraDevice::photoResolutions() const
静止画の撮影に使用できる解像度のリストを返します。
QImageCaptureも参照 。
bool QCameraDevice::operator!=(const QCameraDevice &other) const
このQCameraDevice がother と異なる場合、true を返す。
QCameraDevice &QCameraDevice::operator=(const QCameraDevice &other)
QCameraDevice オブジェクトをother と等しくなるように設定する。
bool QCameraDevice::operator==(const QCameraDevice &other) const
このQCameraDevice がother と等しい場合に真を返す。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.