@@ -34,7 +34,7 @@ Let's first look at how the depth is calculated:
3434
3535.. math ::
3636
37- depth [m ] = focalLength [pix] * baseline [m ] / disparity [pix]
37+ depth [mm ] = focalLength [pix] * baseline [mm ] / disparity [pix]
3838
3939
4040 `RVC2 <https://docs.luxonis.com/projects/hardware/en/latest/pages/rvc/rvc2.html >`__-based cameras have a **0..95 disparity search ** range,
@@ -51,7 +51,7 @@ Here's a graph showing disparity vs depth for OAK-D (7.5cm baseline distance) at
5151
5252 `Full chart here <https://docs.google.com/spreadsheets/d/1ymn-0D4HcCbzYP-iPycj_PIdSwmrLenlGryuZDyA4rQ/edit#gid=0 >`__
5353
54- Note the value of disparity depth data is stored in *uint16 *, where 0 means that the distance is invalid/unknown.
54+ Note the value of depth data is stored in *uint16 *, where 0 means that the distance is invalid/unknown.
5555
5656How baseline distance and focal length affect depth
5757---------------------------------------------------
@@ -106,16 +106,35 @@ the threshold get invalidated, i.e. their disparity value is set to zero. You ca
106106
107107This means that with the confidence threshold, users can prioritize **fill-rate or accuracy **.
108108
109- .. code-block :: python
109+ .. tabs ::
110110
111- stereo_depth = pipeline.create(dai.node.StereoDepth)
112- stereo_depth.initialConfig.setConfidenceThreshold(int )
111+ .. tab :: Python
113112
114- # Or, alternatively, set the Stereo Preset Mode:
115- # Prioritize fill-rate, sets Confidence threshold to 245
116- stereo_depth.setDefaultProfilePreset(dai.node.StereoDepth.PresetMode.HIGH_DENSITY )
117- # Prioritize accuracy, sets Confidence threshold to 200
118- stereo_depth.setDefaultProfilePreset(dai.node.StereoDepth.PresetMode.HIGH_ACCURACY )
113+ .. code-block :: python
114+
115+ # Create the StereoDepth node
116+ stereo_depth = pipeline.create(dai.node.StereoDepth)
117+ stereo_depth.initialConfig.setConfidenceThreshold(threshold)
118+
119+ # Or, alternatively, set the Stereo Preset Mode:
120+ # Prioritize fill-rate, sets Confidence threshold to 245
121+ stereo_depth.setDefaultProfilePreset(dai.node.StereoDepth.PresetMode.HIGH_DENSITY )
122+ # Prioritize accuracy, sets Confidence threshold to 200
123+ stereo_depth.setDefaultProfilePreset(dai.node.StereoDepth.PresetMode.HIGH_ACCURACY )
124+
125+ .. tab :: C++
126+
127+ .. code-block :: cpp
128+
129+ // Create the StereoDepth node
130+ auto stereo_depth = pipeline.create<dai::node::StereoDepth>();
131+ stereo_depth->initialConfig.setConfidenceThreshold(threshold);
132+
133+ // Or, alternatively, set the Stereo Preset Mode:
134+ // Prioritize fill-rate, sets Confidence threshold to 245
135+ stereo_depth->setDefaultProfilePreset(dai::node::StereoDepth::Preset::HIGH_DENSITY);
136+ // Prioritize accuracy, sets Confidence threshold to 200
137+ stereo_depth->setDefaultProfilePreset(dai::node::StereoDepth::Preset::HIGH_ACCURACY);
119138
120139
121140..
@@ -230,7 +249,7 @@ depth change between disparity pixels (eg. 95->94) is the lowest, so the **depth
230249
231250.. image :: /_static/images/components/theoretical_error.jpg
232251
233- It's clear that depth accuracy decreases exponentially with the distance from the camera. Note that with :ref: `Stereo Subpixel mode `
252+ Depth accuracy decreases exponentially with the distance from the camera. Note that with :ref: `Stereo Subpixel mode `
234253enabled you can have better depth accuracy (even at a longer distance) but it only works to some extent.
235254
236255So to conclude, **object/scene you are measuring ** should be **as close as possible to MinZ ** (minimal depth perception) of the camera
0 commit comments