0

Usually, there's a compass and an accelerometer on a typical smartphone these days. So, using information from these sensors can we recreate the whole orientation in which the photo was taken? I mean like if you open the compass app on your phone, it firstly states the direction you are looking (link), how lifted or tilted is your phone in front direction ( I don't know how to state it in a better way) (link) and how much is it titled in sideways (link). Does it cover 3 degrees of freedom (i guess)? Is it enough information to recreate that orientation of the phone?

Also if you think it's not the right place to ask such a question, can you comment where should I ask this question?

karatuno1
  • 11
  • 2

1 Answers1

0

Recording sensor values, it would be possible to restore phone direction in which photo was taken. Some fundamental XR apps(e.g. Google Street View) are actually doing such.

Device rotation

There is a handy helper function, SensorManager.getRotationMatrix exactly for that purpose. Giving magnetic field and gravity sensor-values, you can obtain the device rotation matrix(=complete set of orthogonal 3d basis vectors) which is enough for you to reproduce phone direction afterwards.

Camera orientation

In some cases camera's up direction may be different from device's up direction due to screen orientation changes(portrait or landscape, locked or auto-rotate). So if you handle raw camera inputs, you may need to record screen orientation too. See Display.getRotation.

ardget
  • 2,561
  • 1
  • 5
  • 4