The right translation for the artificial horizon

I would like to draw an artificial horizon. The center of the review will be a perfectly horizontal view with a roll rotating a horizontal line and a step moving it up or down.

The question arises: what is the correct calculation for translating the horizon of the line up or down (step) taking into account the pitch angle.

My guess is that this is likely to depend on the FOV angle that could be assumed for the intended camera, so this angle would have to be a factor in the requested algorithm. Ideally, I would define this angle for the iPhone / iPad camera so that the artificial horizon matches the actual horizon if you hold the device in front of you and look towards the horizon.

So far I have been evaluating the bias, but would like to have an exact formula.

+5
source share
1 answer

Try horizon_offset / (screen_height / 2) = tan (pitch) / tan (vertical_FOV / 2).

Look at the picture, and the formula will turn out by itself.

the picture
(source: zwibbler.com )
.

Update I mixed up two angles. One of them is the angular view of the camera, and the other is the angular view of the screen. These are two different things. The latter depends on the viewing distance. You may need to estimate this distance and adjust the zoom and / or focal length so that the objects visible on the screen have the same angular size as the same objects that are visible to the naked eye. (In my particular phone, you will need to enlarge the image 3 more times after 5x enlargement if the user reaches out to the phone until it stops). Then the two angles coincide, and the formula works.

If you want to enter the magnification (i.e. the objects on the screen have dimensions different from their real counterparts), multiply the horizon offset by the magnification factor.

Update 2 Considering the viewing distance, the screen size is reduced, and the offset just becomes viewing_distance*tan(pitch_angle) (with an increase of one).

+3
source

All Articles