이 페이지에서

QCameraDevice Class

QCameraDevice 클래스는 카메라 장치에 대한 일반적인 정보를 제공합니다. 더 보기...

헤더: #include <QCameraDevice>
CMake: find_package(Qt6 REQUIRED COMPONENTS Multimedia)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia)
qmake: QT += multimedia
QML에서: cameraDevice

공개 타입

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

QCameraDevice 인스턴스는 해당 물리적 장치가 연결이 끊기거나 설정이 변경되더라도 수명 주기 내내 속성을 유지합니다. 업데이트된 속성을 추적하려면, 사용자는 관련 신호가 발생했을 때 QMediaDevices 에서 QCameraDevice의 새 인스턴스를 불러와야 합니다.

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

const QList<QCameraDevice> cameras = QMediaDevices::videoInputs();
for (const QCameraDevice&cameraDevice: 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를 사용하여 설명이나 시스템 내 물리적 위치와 같은 카메라 장치에 대한 일반적인 정보를 얻을 수도 있습니다.

QCamera myCamera;
QCameraDevice cameraDevice = myCamera.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

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

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

position()도 참조하십시오 .

속성 설명서

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

카메라의 기본 방향에 비해 물리적으로 발생한 카메라 회전을 보정하는 데 필요한 회전 각도를 반환합니다. 즉, 이 속성은 출력 이미지가 기기 화면에서 기본 방향으로 똑바로 표시되도록 하기 위해 시계 방향으로 회전시켜야 하는 각도를 나타냅니다. correctionAngle 는 기본 방향에 상대적이므로, 이 값은 기기 방향(세로/가로)이 변경되어도 변하지 않습니다. 보정 각도는 주로 안드로이드에서 0이 아닐 수 있는데, 이는 안드로이드의 경우 기본 방향과 카메라 방향이 제조사에 의해 정의되기 때문입니다.

90도 \a 교정각의 예시

이 열거형은 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()

null 카메라 장치를 생성합니다.

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 와 동일한 장치를 나타내는 경우 true를 반환합니다.

QCameraDevice 의 속성 동작 방식 때문에, 모든 속성이 동일하지 않더라도 두 개의 QCameraDevice 인스턴스가 동일한 것으로 간주될 수 있습니다.

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