Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Howto get shooting direction
Qt 6.11 is out! See what's new in the release blog

Howto get shooting direction

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 2 Posters 1.6k Views 1 Watching
  • 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.
  • A Offline
    A Offline
    Albertino
    wrote on last edited by
    #1

    I use QT/Qml, I'm writing an app where user can shoot a photo.
    I need to know the position of the user at the shoot time and what direction his camera is pointing.
    Then, with this informations I want to show a point on the map and an arrow indicating the shooting direction.

    I can read GPS position (Lat,Lon) using PositionSource and that's ok, but how to get the camera rotation angles?
    Any suggestions?

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      Something like https://doc.qt.io/qt-5.10/qml-qtsensors-rotationsensor.html?

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      1
      • A Offline
        A Offline
        Albertino
        wrote on last edited by
        #3

        If I have correctly understood the documentation the angle indicating the direction to the north is myRotationSensor.reading.z

        I also found the Compass class that gives me myCompassSensor.reading.azimuth directly

        Which is the best?

        If I tilt the phone up, the azimuth value (also from myRotationSensor.reading.z) will gradually change from 0 to 180 but myRotationSensor.reading.x remains around 90 degrees, how to correct this value? Should I compensate with myRotationSensor.reading.y? how?

        Thank you.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Albertino
          wrote on last edited by
          #4

          I solved the problem using the combination of magnetometer / accelerometer

          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