Skip to content

Instantly share code, notes, and snippets.

@harryzhurov
Last active March 4, 2024 07:54
Show Gist options
  • Save harryzhurov/c341e7bb9904e06195cf797822f7967d to your computer and use it in GitHub Desktop.
Save harryzhurov/c341e7bb9904e06195cf797822f7967d to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"id": "754128e3-bd3b-409f-abe9-f04b593a630d",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"HFOV: 4.148588694507044\n",
"VFOV: 3.320959112842064\n"
]
}
],
"source": [
"from math import atan, degrees\n",
"\n",
"x = 640\n",
"y = 512\n",
"f = 0.15 # focus in m\n",
"p = 17e-6 # pixel pitch, m\n",
"\n",
"hfov_rad = atan(x*p/f) # HFOV in radians\n",
"vfov_rad = atan(y*p/f) # VFOV in radians\n",
"\n",
"hvof_deg = degrees(hfov_rad) # HFOV in degrees\n",
"vfov_deg = degrees(vfov_rad) # HFOV in degrees\n",
"\n",
"print('HFOV:',hvof_deg)\n",
"print('VFOV:',vfov_deg)\n",
"\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment