One pleasant surprise for computer vision on a mobile device is that we can detect the 3D orientation of the camera from other sensors. An iPhone has an accelerometer and a gyroscope (among complementary sensors not discussed here).
Let’s look at the basic physics. The accelerometer detects the acceleration of the device in 3 perpendicular directions. This has two parts: the gravitational pull of the earth and the motion of the device caused by the user. The gyroscope detects the rotation around three perpendicular axes caused by the user, the change in 3D attitude.
If the iPhone is static we know 2 out of 3 attitude parameters from the gravitational direction. The third one needs to be set. The best option is to point at our object of interest in the field of view of the camera. That anchors it.