Skip to content

Class CameraOrientationNormalizer

ClassList > CameraOrientationNormalizer

Compensates for incorrect camera orientation on iOS and Windows. More...

  • #include <cameraorientationnormalizer.h>

Inherits the following classes: QObject

Public Properties

Type Name
property int previewRotation

Public Signals

Type Name
signal void previewRotationChanged

Public Functions

Type Name
CameraOrientationNormalizer (QObject * parent=nullptr)
Q_INVOKABLE bool normalizeImageOrientation (const QString & path)
int previewRotation () const
Q_INVOKABLE void recordCaptureOrientation ()

Detailed Description

On iOS and Windows, Qt Multimedia's backend produces an inverted camera preview in landscape mode and writes captured photos with incorrect orientation or bogus EXIF tags (QTBUG-118594).

This class provides: previewRotation for correcting the live VideoOutput orientation normalizeImageOrientation() for correcting saved JPEG files

Public Properties Documentation

property previewRotation [1/2]

int CameraOrientationNormalizer::previewRotation;

Public Signals Documentation

signal previewRotationChanged

void CameraOrientationNormalizer::previewRotationChanged;

Public Functions Documentation

function CameraOrientationNormalizer

explicit CameraOrientationNormalizer::CameraOrientationNormalizer (
    QObject * parent=nullptr
) 

function normalizeImageOrientation

Q_INVOKABLE bool CameraOrientationNormalizer::normalizeImageOrientation (
    const QString & path
) 

Ensures the JPEG at path has pixels matching the orientation recorded by recordCaptureOrientation(). Rotates the image if pixel dimensions contradict the capture orientation and strips any non-identity EXIF orientation tag.

Returns false without touching the file when no correction is needed.


function previewRotation [2/2]

int CameraOrientationNormalizer::previewRotation () const

function recordCaptureOrientation

Q_INVOKABLE void CameraOrientationNormalizer::recordCaptureOrientation () 

Records the current screen orientation. Call at shutter press so that normalizeImageOrientation() has a ground-truth reference.



The documentation for this class was generated from the following file src/core/cameraorientationnormalizer.h