[Interest] QML Camera: resulting image is rotated
jhihn at gmx.com
Wed Dec 12 20:07:49 CET 2018
Sent: Tuesday, December 11, 2018 at 4:09 AM
From: "Alexander Ivash" <elderorb at gmail.com>
To: "interestqt-project.org" <interest at qt-project.org>
Subject: Re: [Interest] QML Camera: resulting image is rotated
On Dec 11 2018, at 6:47 am, 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
metaData.orientation: cameraUpsideDown ? 180 : 0
orientation: cameraUpsideDown ? 180 : 0
And then if you need to preview images made by this camera you can bind their orientation to EXIF values:
I think you understood correct, with a small difference: I need actual QImage in correct orientation, not just Image capable to show it properly.
For now I temporarily gave up searching right solution and instead of using 'onImageSaved' started using 'onImageCaptured' and then stealing QImage from Qt image cache. As I understand 'onImageCaptured' gives just a preview, but I haven't noticed any focus issues or resolution issues or other major issues (well, maybe there is something wrong with white balance) for preview image.
As for the metadata - I tried it before, but for some reasons metaData.orientation was 'undefined' in my case. I need to check on different device to be fully sure I can't trust metadata.
The only differences are that *Captured gives you the viewfinder resolution, not the configured image saving resolution and that *Captured happens even if *Saved doesn't (permissions, disk space issues). Focus, etc, are all the same for both images.
More information about the Interest