# Calculating a drone camera's image footprint OR How I learned to love tan again.

When we use drones for mapping purposes, we usually program them to fly autonomously along a pre-programmed flight path, collecting images with a specified front- and side- overlap. Once we have enough images covering the area to be mapped, we stitch them all together to create the final map. This really doesn’t require us to think a lot about the length and width of each image; the only two limiting factors we usually need to consider are the final map’s (or technically, orthorectified mosaic’s) spatial resolution and the drone’s maximum legal height.

However, one of the projects we’re currently working on is not so much a mapping project as it is ecological research, and to cut a long story short, ensuring that we can correctly apply a set of ecological statistical tools that account for double-counting and observer error requires us to be able to ascertain the length and width of each image at different drone altitudes. Also, as we work with a number of different drones (and thus drone cameras), I wanted to have a set of equations in place that we could use for a variety of situations. All of this required some high-school level trigonometry to work out; I was never a fan of trigonometry as a teenager, but using it to understand both the Triangular Greenness Index (as detailed in a previous post on vegetation indices) and the current problem was actually a lot of fun.

To break the problem down, the two fixed variables are a camera’s field of view (FoV), which is described as the angle which it can ‘see’ at any given instant, and its aspect ratio, which is the ratio between the length and width of its images. For example, from the technical descriptions, a Phantom 3 Advanced camera has a FoV of 94° and user-selectable aspect ratios of 4:3 and 16:9, while the Phantom 4 Pro 2.0 has an FoV of 84° and user-selectable aspect ratios of 3:2, 4:3 and 16:9. In combination with the height of the drone, these two camera-parameters determine the final image footprint. For more on aspect ratios, see this post which recommends using the native aspect ratio for any given camera.

Caveats:

! These equations assume the camera to be perpendicular to the ground and don’t account for lens distortion. For a far more complex solution (which I have to admit I barely understand) look up this post (StackExchange) where mountainunicycler (Github user) describes nesting a Python script within Latex (what) which then calculates the FoV of a drone-mounted camera and outputs a PDF with graphics ( I can’t even.) !

```x = Drone Height
θ = Field of View
r = Aspect Ratio

If the diagonal of the image is D, D/2 is the length of the base
of the right-angled triangle with the two included angles as θ°/2
and (180°-θ°)/2 (as becomes clear when the FoV angle is bisected
to create two identical right-angled triangles).

D = 2 * x * tan(θ°/2)   --- (1)

If (A) and (B) are the sides of the image, then the aspect ratio
(r) is equal to either A/B or B/A. We assume (A) to be the
independent variable and (B) to be the dependent variable.

r = A / B
B = r * A   --- (2)

Using the equation of a right-angled triangle again,

D^2 = A^2 + B^2
D^2 = A^2 + (r * A)^2   - substituting the value of B from (2)
D^2 = A^2 * (1 + r^2)
A^2 = D^2 / (1 + r^2)       - flipping the terms of the equation

A = D / sqrt(1 + r^2)       --- (3)
B = r * D / sqrt(1 + r^2)   --- (4)

To express (A) and (B) only in terms of x, θ and r, we now
combine equations (1) and (3), and (1) and (4).

A = (2 * x * tan(θ°/2)) / sqrt(1 + r^2) --- (5)

and

B = r * (2 * x * tan(θ°/2)) / sqrt(1 + r^2) - from (1) and (4)
B = 2 * r * x * tan(θ°/2) / (sqrt(1 + r^2) --- (6)```

So, if we know the field of view (θ°), the aspect ratio (r) and the height of the drone (x), equations (5) and (6) allow us to determine the image footprint. To calculate the area of the image, the math is simply (A) * (B), which is the formula for the area of a triangle.

To flip this around, the other equation we needed for this project was to determine the height we needed to fly the drone, given a specific image footprint i.e. given (A), calculate (x). This is straightforward, since it means we just need to make (x) the subject, as opposed to (A), in equation (5).

```A = (2 * x * tan(θ/2)) / sqrt(1 + r^2) --- (5)

2 * x * tan(θ/2)) = A * sqrt(1 + r^2)

x = A * sqrt(1 + r^2) / (2 * tan(θ/2)) --- (7)```

In summary, equations (5) and (6) allow us to use the FoV, aspect ratio and height of any given camera to determine the image footprint, while equation (7) allows us to determine what height we should fly a drone at, given a desired horizontal image dimension.

I’ve used these equations to create a calculator in Excel; note that Excel uses radians as the default unit for angles. Using this calculator, I can determine that with a FoV of 94°, an aspect ratio of 4:3 and a drone height of 60m, the image footprint would be 102.9m * 77.2m, while with an FoV of 77°, an aspect ratio of 16:9 and the same drone height, the image footprint would be 83.1m * 46.8m. Similarly, if I wanted an image length of 50m with the first camera (FoV = 94° and aspect ration = 4:3), I would need to fly the drone at a height of 41.25m.

Let us know if you have any comments or find any errors in the math! We’re on Twitter at @techforwildlife, and you can mail us at contact@techforwildlife.com. As usual, comments on this post will be open for a few days.