import math def getFocallength(hFov_deg, width): return width/(2 * math.tan((hFov_deg * math.pi / 180)/2))