Solved Howto get shooting direction
-
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? -
Something like https://doc.qt.io/qt-5.10/qml-qtsensors-rotationsensor.html?
-
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.
-
I solved the problem using the combination of magnetometer / accelerometer