[Interest] QML Camera: resulting image is rotated

René Hansen renehh at gmail.com
Tue Dec 11 08:26:59 CET 2018


So far I haven't seen a case where the VideoOutput doesn't get the
orientation correct on a Camera preview, but that's still only from a 5-10
different devices I've tested, (ios, android, mac). That's where I got the
logic from in my original reply. Have a look at:

https://github.com/qt/qtmultimedia/blob/5.11/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp


/René

On Tue, 11 Dec 2018 at 04:53 Artem Sidyakin <artem.sidyakin at qt.io> wrote:

> As far as I know, it is impossible to tell in which position the camera is
> before you actually see its viewfinder in VideoOutput :)
>
> In my case I had a camera upside-down, so 180 degree rotation. I managed
> it like this:
>
> property bool cameraUpsideDown: true
>
> Camera {
>     id: camera
>     metaData.orientation: cameraUpsideDown ? 180 : 0
>     // ...
> }
>
> VideoOutput {
>     orientation: cameraUpsideDown ? 180 : 0
>     source: camera
>     // ...
> }
>
> And then if you need to preview images made by this camera you can bind
> their orientation to EXIF values:
>
> Image {
>     autoTransform: true
>     // ...
> }
>
> But I feel like I misunderstood your question.
>
> ---
> Artem Sidyakin
>
> > On 9 Dec 2018, at 23:53, Alexander Ivash <elderorb at gmail.com> wrote:
> >
> > пн, 10 дек. 2018 г. в 12:33, René Hansen <renehh at gmail.com>:
> > You can get the Camera orientation like so:
> >
> > QCamera *cam = qvariant_cast<QCamera
> *>(m_filter->camera()->property("mediaObject"));
> > QCameraInfo(*cam).orientation()
> >
> > Then in case orientation is not % 180, you can rotate the image.
> >
> >
> >  Is it the same as QML Camera's 'orientation' ?
> http://doc.qt.io/qt-5/qml-qtmultimedia-camera.html#orientation-prop
> > Or this is actual orientation? Maybe you could share sample which
> 'unrotate' based on this property?
> >
> >
> > _______________________________________________
> > Interest mailing list
> > Interest at lists.qt-project.org
> > https://lists.qt-project.org/listinfo/interest
>
> _______________________________________________
> Interest mailing list
> Interest at lists.qt-project.org
> https://lists.qt-project.org/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181211/fcc70885/attachment.html>


More information about the Interest mailing list