Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QML Camera Image Orientation
Forum Updated to NodeBB v4.3 + New Features

QML Camera Image Orientation

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 1 Posters 711 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • i.n.g.o.I Offline
    i.n.g.o.I Offline
    i.n.g.o.
    wrote on last edited by
    #1

    Hi.

    I am struggling with the orientation of a photo taken with a QML Camera on Android.
    Qt 5.12.2

    The image preview is a QML Image with autoTransform:true. When before triggering imageCapture i look up the device orientation with a OrientationSensor and rotate the image (after capture is done) according to the devices orientation:

        function orientationToAngle(orientation, w, h) {
            switch (orientation) {
            case 2: return 180
            case 3: return -90
            case 4: return 90
            }
    
            return w > h ? -90 : 0;
        }
    

    This works for most of the cases.
    But it seems that the Camera and the OrientationSensor have different interpretations of when the Face is up or not.
    I end up with 180° rotated previews if i hold my device roughly 30-45° the right side up.

    Is there a fool-proof way of getting this right?
    There is no Metadata available in the image/the camera.

    All i want is a fullscreen camera with image-preview...

    thanks for any tips.
    ingo

    1 Reply Last reply
    0
    • i.n.g.o.I Offline
      i.n.g.o.I Offline
      i.n.g.o.
      wrote on last edited by
      #2

      i found this in the forum:
      https://forum.qt.io/topic/83036/confuse-with-camera-orientation/2

      but would not know how to do:
      surfaceFormat.scanLineDirection()

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved