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 안에 포함되어 있습니다.

이 예제는 사용 가능한 모든 카메라의 이름을 출력합니다:

const QList<QCameraDevice> 카메라 = QMediaDevices::videoInputs();for(const QCameraDevice &cameraDevice: 카메라)    qDebug() << cameraDevice.description();

QCamera다음 예제는 카메라 장치 이름이 mycameraQCamera 을 인스턴스화하는 데 사용할 수 있습니다:

const QList<QCameraDevice> cameras = QMediaDevices::videoInputs();
for (const QCameraDevice &cameraDevice : cameras) {
    if (cameraDevice.description() == "mycamera")
        camera = new QCamera(cameraDevice);
}

또한 QCameraDevice를 사용하여 설명 및 시스템에서의 물리적 위치와 같은 카메라 장치에 대한 일반 정보를 가져올 수도 있습니다.

QCamera myCamera;QCameraDevice cameraDevice =  camera->cameraDevice();if (cameraDevice.position()==. 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

이 열거형은 시스템 하드웨어에서 카메라의 물리적 위치를 지정합니다.

Constant설명
QCameraDevice::UnspecifiedPosition0카메라 위치가 지정되지 않았거나 알 수 없습니다.
QCameraDevice::BackFace1카메라가 시스템 하드웨어의 뒷면에 있습니다. 예를 들어 모바일 디바이스의 경우 화면의 반대편에 있다는 의미입니다.
QCameraDevice::FrontFace2카메라가 시스템 하드웨어의 전면에 있습니다. 예를 들어 모바일 디바이스에서는 화면과 같은 면에 있다는 의미입니다. 전면 카메라는 QVideoFrame::mirrored 속성이 true 으로 설정된 비디오 프레임을 생성합니다. 즉, 이러한 프레임의 표시가 수직 축을 중심으로 뒤집혀 비디오 출력을 거울로 표시하는 반면, 녹화는 QVideoFrame::surfaceFormat 에 지정된 표면의 변형만 고려합니다.

position()도 참조하세요 .

속성 문서

[read-only, since 6.7] correctionAngle : const QtVideo::Rotation

기본 방향과 비교하여 카메라의 물리적 카메라 회전을 보정하는 데 필요한 회전 각도를 반환합니다. 즉, 이 속성은 출력 이미지가 기본 방향에서 장치 화면에서 똑바로 서기 위해 회전해야 하는 시계 방향 각도를 나타냅니다. correctionAngle 은 기본 방향에 상대적이므로 디바이스 방향(세로/가로)을 변경해도 이 값은 변경되지 않습니다. 기본 방향과 카메라 방향이 제조업체에서 정의하는 Android에서는 대부분 보정 각도가 0이 아닐 수 있습니다.

Example with 90 degrees \a correctionAngle

이 속성은 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

QCameraDeviceother 과 다르면 true를 반환합니다.

QCameraDevice &QCameraDevice::operator=(const QCameraDevice &other)

QCameraDevice 객체를 other 과 동일하게 설정합니다.

bool QCameraDevice::operator==(const QCameraDevice &other) const

QCameraDeviceother 과 같으면 true를 반환합니다.

© 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.