I'm already using a reference to Camera QML component to get some
Forgot to add, that m_filter->camera() in the snippet above, is just a
reference to a Camera QML component.
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.
/René
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.
have not tried this. please let me know if you'll find a way
In my case VideoOutput always shows preview in correct orientation,
have you tested on iOS and FrontFace Camera ? in my use-cases
I needed rotation of 180 for preview (VideoOutput)
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.
haven't found any info about
ciao
ekke
Regards, Alexander
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
Open Tracking
|
_______________________________________________
Interest mailing list
|
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
// 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
  // test also front camera bugs
https://bugreports.qt.io/browse/QTBUG-37955
and https://bugreports.qt.io/browse/QTBUG-67985
  autoTransform: isIos? false : true
  rotation: 0
 } // photoPreview
// ROTATE BEFORE CAPTURE
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
https://lists.qt-project.org/listinfo/interest
Open Tracking
_______________________________________________
Interest mailing list
https://lists.qt-project.org/listinfo/interest