Skip to content

Commit 8490f76

Browse files
committed
Updated ToF docs, added formulas for max distance, fixed IOs, updated example
1 parent 8aac9f7 commit 8490f76

File tree

2 files changed

+46
-10
lines changed

2 files changed

+46
-10
lines changed

docs/source/components/nodes/tof.rst

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,31 +30,39 @@ Inputs and Outputs
3030
.. code-block::
3131
3232
┌───────────┐ depth
33-
inputConfig | ├────────►
34-
───────────►│ | amplitude
35-
input | ToF ├────────►
36-
───────────►│ │ error
33+
│ ├────────►
34+
inputConfig | | amplitude
35+
───────────►│ ├────────►
36+
│ ToF │ error
37+
input | ├────────►
38+
───────────►│ │ intensity
3739
│ ├────────►
3840
└───────────┘
3941
42+
43+
4044
**Message types**
4145

4246
- ``inputConfig`` - :ref:`ToFConfig`
4347
- ``input`` - :ref:`ImgFrame`
44-
- ``depth`` - :ref:`ImgFrame`
48+
- ``depth`` - :ref:`ImgFrame` - Decoded depth map
4549
- ``amplitude`` - :ref:`ImgFrame`
46-
- ``error`` - :ref:`ImgFrame`
50+
- ``intensity`` - :ref:`ImgFrame`
51+
- ``phase`` - :ref:`ImgFrame` Phase image, useful for debugging (FP32)
4752

4853
ToF Settings
4954
############
5055

51-
In :ref:`ToF depth` example we allow users to quickly configure the following ToF settings:
56+
In :ref:`ToF depth` example we allow users to quickly configure ToF settings. These are mostly for debugging, and should be enabled:
5257

53-
- FFPN Correction; It's a process that corrects the fixed pattern noise (FPN) of the ToF sensor. It's enabled by default for best performance.
58+
- FPPN Correction; It's a process that corrects the fixed pattern noise (FPN) of the ToF sensor. It's enabled by default for best performance.
5459
- Wiggle Correction: It's a process that corrects the wiggle effect of the ToF sensor. It's enabled by default for best performance.
5560
- Temperature Correction: It's a process that corrects the temperature effect of the ToF sensor. It's enabled by default for best performance.
61+
62+
And these settings are up to the user:
63+
5664
- Optical Correction: It's a process that corrects the optical effect (On -> ToF returns distance represented by Green Line), so it matches :ref:`StereoDepth` depth reporting.
57-
- Phase Unwrapping - Process that corrects the phase wrapping effect of the ToF sensor. You can set it to [0..4]. The higher the number, the longer the ToF range, but it also increases the noise.
65+
- Phase Unwrapping - Process that corrects the phase wrapping effect of the ToF sensor. You can set it to [0..5 are optimized]. The higher the number, the longer the ToF range, but it also increases the noise.
5866
- `0` - Disabled.
5967
- `1` - Up to 1.5 meters
6068
- `2` - Up to 3 meters
@@ -63,6 +71,24 @@ In :ref:`ToF depth` example we allow users to quickly configure the following To
6371

6472
.. image:: /_static/images/components/tof-optical-correction.png
6573

74+
Max distance
75+
############
76+
77+
Maximum ToF distance depends on the phase unwrapping level and modulation frequency. The formula for calculating the maximum distance is:
78+
79+
.. math::
80+
:nowrap:
81+
82+
\begin{align*}
83+
c & = 299792458.0 \quad \text{//! speed of light in m/s} \\
84+
MAX\_80MHZ\_MM & = \frac{c}{80000000 \times 2} \times 1000 \quad \text{//! convert speed of light to mm/160ns} \\
85+
MAX\_MM\_80MHZ & = \text{round}(MAX\_80MHZ\_MM) \quad \text{// round(1873.7) -> 1874} \\
86+
MAX\_DIST\_80MHZ & = 1874 \times (\text{phaseUnwrappingLevel} + 1) \quad \text{//! in mm for 80 MHz} \\
87+
MAX\_100MHZ\_MM & = \frac{c}{100000000 \times 2} \times 1000 \quad \text{//! convert speed of light to mm/200ns} \\
88+
MAX\_MM\_100MHZ & = \text{round}(MAX\_100MHZ\_MM) \quad \text{// round(1498.9636) -> 1499} \\
89+
MAX\_DIST\_100MHZ & = 1499 \times (\text{phaseUnwrappingLevel} + 1) \quad \text{//! in mm for 100 MHz}
90+
\end{align*}
91+
6692
Usage
6793
#####
6894

@@ -73,10 +99,19 @@ Usage
7399
pipeline = dai.Pipeline()
74100

75101
tof_cam = pipeline.create(dai.node.Camera)
102+
# Decoded depth FPS will be /2 due to shuffle/non-shuffle averaging
103+
tof_cam.setFps(60)
76104
# We assume the ToF camera sensor is on port CAM_A
77105
tof_cam.setBoardSocket(dai.CameraBoardSocket.CAM_A)
78106

79107
tof = pipeline.create(dai.node.ToF)
108+
109+
# Higher number => faster processing. 1 shave core can do 30FPS.
110+
tof.setNumShaves(1)
111+
112+
# Median filter, kernel size 5x5
113+
tof.initialConfig.setMedianFilter(dai.MedianFilter.KERNEL_5x5)
114+
80115
# ToF node converts raw sensor frames into depth
81116
tof_cam.raw.link(tof.input)
82117

docs/source/samples/ToF/tof_depth.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on the ToF sensor.
1717

1818
With keyboard you can configure ToF settings:
1919

20-
- FFPN Correction; Turn on/off with `f`. It's a process that corrects the fixed pattern noise (FPN) of the ToF sensor. Should be enabled.
20+
- FPPN Correction; Turn on/off with `f`. It's a process that corrects the fixed pattern noise (FPN) of the ToF sensor. Should be enabled.
2121
- Wiggle Correction: Turn on/off with `w`. It's a process that corrects the wiggle effect of the ToF sensor. Should be enabled.
2222
- Temperature Correction: Turn on/off with `t`. It's a process that corrects the temperature effect of the ToF sensor. Should be enabled.
2323
- Optical Correction: Turn on/off with `o`. It's a process that corrects the optical effect (On -> ToF returns distance represented by Green Line), so it matches stereo depth reporting.
@@ -27,6 +27,7 @@ With keyboard you can configure ToF settings:
2727
- `2` - Up to 3 meters
2828
- `3` - Up to 4.5 meters
2929
- `4` - Up to 6 meters
30+
- `5` - Up to 6 meters
3031

3132
.. image:: /_static/images/components/tof-optical-correction.png
3233

0 commit comments

Comments
 (0)