Skip to content

Commit

Permalink
Merge pull request #911 from luxonis/fix_formulas
Browse files Browse the repository at this point in the history
Fix docs formulas for calibration readers
  • Loading branch information
Erol444 authored Nov 16, 2023
2 parents 01a5593 + ea7048b commit 600e863
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions docs/source/samples/calibration/calibration_reader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Here's theoretical calculation of the focal length in pixels:

.. math::
focalLength = width_px * 0.5 / tan(hfov * 0.5 * pi / 180)
f_x = \text{width}_x \cdot \frac{1}{\tan \left(\frac{\text{HFOV}_x}{2}\frac{\pi}{180}\right)}
To get the HFOV you can use `this script <https://gist.github.com/Erol444/4aff71f4576637624d56dce4a60ad62e>`__, which also works for wide-FOV cameras and allows you to
specif alpha parameter.
Expand All @@ -36,13 +36,14 @@ With 400P (640x400) camera resolution where HFOV=71.9 degrees:

.. math::
focalLength = 640 * 0.5 / tan(71.9 * 0.5 * PI / 180) = 441.25
f_x = 640 \cdot \frac{1}{\tan \left(\frac{71.9}{2}\frac{\pi}{180}\right)} = 441.25
And for 800P (1280x800) camera resolution where HFOV=71.9 degrees:

.. math::
focalLength = 1280 * 0.5 / tan(71.9 * 0.5 * PI / 180) = 882.5
f_x = 1280 \cdot \frac{1}{\tan \left(\frac{71.9}{2}\frac{\pi}{180}\right)} = 882.5
Expand Down
4 changes: 2 additions & 2 deletions docs/source/tutorials/configuring-stereo-depth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ Let's first look at how the depth is calculated:

.. math::
depth [mm] = focalLength [pix] * baseline [mm] / disparity [pix]
\text{depth[mm]} =f_{x}\text{[px]} \cdot \frac{\text{baseline[mm]}}{\text{disparity[px]}}
Examples for calculating the depth value, using the OAK-D (7.5cm baseline OV9282), for 400P resolution and disparity of 50 pixels:

.. math::
depth = 441.25 * 7.5 / 50 = 66.19 cm
\text{depth} = 441.25 \cdot \frac{7.5}{50} = 66.19 \text{ cm}
`RVC2 <https://docs.luxonis.com/projects/hardware/en/latest/pages/rvc/rvc2.html>`__-based cameras have a **0..95 disparity search** range,
which limits the minimal depth perception. Baseline is the distance between two cameras of the
Expand Down

0 comments on commit 600e863

Please sign in to comment.