Thanks!

But frankly speaking this is not the answer I hoped to get :). Have you tried 
to extract rotation from exif / metadata? This is what I'm going to do if don't 
find better way. In my case VideoOutput always shows preview in correct 
orientation, so looks like Qt knows how to rotate preview frames properly (why 
doesn't it use this knowledge to rotate saved image or why doesn't it expose it 
- this is another question). But if Qt knows - there should be some source of 
information where it gets such a knowledge.
Regards, Alexander
On Dec 9 2018, at 8:17 pm, ekke <[email protected]> wrote:
>
> Am 09.12.18 um 16:57 schrieb Alexander Ivash:
> >
> > Is it possible to understand the angle to un-rotate? I've tried to 
> > un-rotate based on orientation from VideoOtput but it doesn't work 
> > uniformly on all the devices.
> > Regards, Alexander
> >
> >
> > _______________________________________________
> > Interest mailing list
> > [email protected] 
> > (https://link.getmailspring.com/link/[email protected]/0?redirect=mailto%3AInterest%40lists.qt-project.org&recipient=aW50ZXJlc3RAcXQtcHJvamVjdC5vcmc%3D)https://lists.qt-project.org/listinfo/interest
> >  
> > (https://link.getmailspring.com/link/[email protected]/1?redirect=https%3A%2F%2Flists.qt-project.org%2Flistinfo%2Finterest&recipient=aW50ZXJlc3RAcXQtcHJvamVjdC5vcmc%3D)
> Alexander,
>
> from my experiences it's not so easy.
> it depends from device and how the camera module is physically mounted
> so I'm doing it for my customers hardcoded while waiting that QML will handle 
> this
> here's some code from customer app
> it's on my TODO to extract the code and create example app and blog and 
> create all the specific issues - but expect 2019
> To get some ideas:
> // V I D E O O U T P U T
> VideoOutput {
> source: camera
> anchors.fill: parent
> focus : visible
> autoOrientation: true
> rotation: isIos && isFrontFace ? 180:0
> } // Video Output
>
>
> // P R E V I E W I M A G E
> Image {
> id: photoPreview
> fillMode: Image.PreserveAspectFit
> anchors.fill: parent
> property bool isPortraitAtCaptureTime: false
> // i O S BUG
> // on iOS we don't use autoTransform - otherwise orientation would be wrong
> // instead we're calculating rotation of Image
> // we also must calculate rotation 180 for VideoOutput if iOS and FrontFace
> // see also
> // https://bugreports.qt.io/browse/QTBUG-50056 
> (https://link.getmailspring.com/link/[email protected]/2?redirect=https%3A%2F%2Fbugreports.qt.io%2Fbrowse%2FQTBUG-50056&recipient=aW50ZXJlc3RAcXQtcHJvamVjdC5vcmc%3D)
> // test also front camera bugs https://bugreports.qt.io/browse/QTBUG-37955 
> (https://link.getmailspring.com/link/[email protected]/3?redirect=https%3A%2F%2Fbugreports.qt.io%2Fbrowse%2FQTBUG-37955&recipient=aW50ZXJlc3RAcXQtcHJvamVjdC5vcmc%3D)
>  and https://bugreports.qt.io/browse/QTBUG-67985 
> (https://link.getmailspring.com/link/[email protected]/4?redirect=https%3A%2F%2Fbugreports.qt.io%2Fbrowse%2FQTBUG-67985&recipient=aW50ZXJlc3RAcXQtcHJvamVjdC5vcmc%3D)
> autoTransform: isIos? false : true
> rotation: 0
> } // photoPreview
>
> // ROTATE BEFORE CAPTURE
> // iOS rotation calculated in cpp:
> int PhotoUtil::cameraScreenRotation(const bool isBackFace, const int 
> cameraOrientation)
> {
> const int screenAngle = mScreen->angleBetween(mScreen->nativeOrientation(), 
> mScreen->orientation());
> int rotation;
> if (isBackFace) {
> rotation = (360 - cameraOrientation + screenAngle) % 360;
> } else {
> rotation = (cameraOrientation - screenAngle) % 360;
> }
> return rotation;
> }
> if(isIos) {
> photoUtil.rotateScaleSaveCapturedImage(camera.imageCapture.capturedImagePath, 
> requestId, theEntity, photoPreview.rotation)
> } else {
> // X C O V E R
> if(isSamsungXCover) {
> if(photoPreview.isPortraitAtCaptureTime) {
> if(isBackFace) {
> // PORTRAIT BACK: rotate 90°
> photoUtil.rotateScaleSaveCapturedImage(camera.imageCapture.capturedImagePath, 
> requestId, theEntity, 90)
> } else {
> // PORTRAIT FRONT: rotate -90°
> photoUtil.rotateScaleSaveCapturedImage(camera.imageCapture.capturedImagePath, 
> requestId, theEntity, -90)
> }
> } else {
> // LANDSCAPE BACK or FRONT: rotate 180°
> photoUtil.rotateScaleSaveCapturedImage(camera.imageCapture.capturedImagePath, 
> requestId, theEntity, 180)
> }
> }
> // P I X E L C
> else if(isPixelC) {
> if(photoPreview.isPortraitAtCaptureTime) {
> if(isBackFace) {
> // PORTRAIT BACK: rotate 90°
> photoUtil.rotateScaleSaveCapturedImage(camera.imageCapture.capturedImagePath, 
> requestId, theEntity, 90)
> } else {
> // PORTRAIT FRONT: rotate -90°
> photoUtil.rotateScaleSaveCapturedImage(camera.imageCapture.capturedImagePath, 
> requestId, theEntity, -90)
> }
> } else {
> // LANDSCAPE BACK or FRONT: OK
> photoUtil.rotateScaleSaveCapturedImage(camera.imageCapture.capturedImagePath, 
> requestId, theEntity, 0)
> }
> }
> // NO SPECIAL DEVICE WITH MANAGED ORIENTATION
> else {
> photoUtil.rotateScaleSaveCapturedImage(camera.imageCapture.capturedImagePath, 
> requestId, theEntity, 0)
> }
> }
>
>
> have tried with some devices and also created a Settings Page where customer 
> can enter rotation needed for FrontFace or BackFace camera for a specific 
> model, so I can add this
> ekke
> _______________________________________________
> Interest mailing list
> [email protected]
> https://lists.qt-project.org/listinfo/interest
>

_______________________________________________
Interest mailing list
[email protected]
https://lists.qt-project.org/listinfo/interest

Reply via email to