Skip to content

Commit b549032

Browse files
committed
Added disparity shift docs
1 parent 40b2682 commit b549032

File tree

1 file changed

+28
-18
lines changed

1 file changed

+28
-18
lines changed

docs/source/components/nodes/stereo_depth.rst

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
StereoDepth
2-
===========
2+
###########
33

4-
Stereo depth node calculates the disparity/depth from two :ref:`mono cameras <MonoCamera>`.
4+
StereoDepth node calculates the disparity/depth from the stereo camera pair (2x :ref:`MonoCamera <MonoCamera>`).
55

66
How to place it
7-
###############
7+
===============
88

99
.. tabs::
1010

@@ -20,7 +20,7 @@ How to place it
2020

2121

2222
Inputs and Outputs
23-
##################
23+
==================
2424

2525
.. code-block::
2626
@@ -71,7 +71,7 @@ Inputs and Outputs
7171
- :code:`debugDispCostDump` - :ref:`ImgFrame`
7272

7373
Internal block diagram of StereoDepth node
74-
##########################################
74+
==========================================
7575

7676
.. image:: /_static/images/components/depth_diagram.png
7777
:target: https://whimsical.com/stereo-node-EKcfcXGjGpNL6cwRPV6NPv
@@ -83,7 +83,7 @@ configurable sooner.
8383
If you click on the image, you will be redirected to the webapp. Some blocks have notes that provide additional technical information.
8484

8585
Currently configurable blocks
86-
*****************************
86+
-----------------------------
8787

8888
.. tabs::
8989

@@ -165,12 +165,12 @@ Currently configurable blocks
165165
:no-link:
166166

167167
Limitations
168-
###########
168+
===========
169169

170170
- Median filtering is disabled when subpixel mode is set to 4 or 5 bits.
171171

172172
Stereo depth FPS
173-
################
173+
================
174174

175175
.. list-table::
176176
:header-rows: 1
@@ -201,7 +201,7 @@ All stereo modes were measured for :code:`depth` output with **5x5 median filter
201201
to **60 FPS** and for 400P mono cameras were set to **110 FPS**.
202202

203203
Usage
204-
#####
204+
=====
205205

206206
.. tabs::
207207

@@ -238,15 +238,15 @@ Usage
238238
right->out.link(stereo->right);
239239

240240
Examples of functionality
241-
#########################
241+
=========================
242242

243243
- :ref:`Depth Preview`
244244
- :ref:`RGB Depth alignment`
245245
- :ref:`Mono & MobilenetSSD & Depth`
246246
- :ref:`RGB & MobilenetSSD with spatial data`
247247

248248
Reference
249-
#########
249+
=========
250250

251251
.. tabs::
252252

@@ -266,7 +266,7 @@ Reference
266266
:undoc-members:
267267

268268
Disparity
269-
#########
269+
=========
270270

271271
Disparity refers to the distance between two corresponding points in the left and right image of a stereo pair.
272272
By looking at the image below, it can be seen that point :code:`X` gets projected to :code:`XL = (u, v)` in the :code:`Left view` and :code:`XR = (p, q)` in the :code:`Right view`.
@@ -290,7 +290,7 @@ For the final disparity map, a filtering is applied based on the confidence thre
290290
the threshold get invalidated, i.e. their disparity value is set to zero. You can set the confidence threshold with :code:`stereo.initialConfig.setConfidenceThreshold()`.
291291

292292
Calculate depth using disparity map
293-
###################################
293+
===================================
294294

295295
Disparity and depth are inversely related. As disparity decreases, depth increases exponentially depending on baseline and focal length. Meaning, if the disparity value is close to zero, then a small change in disparity generates a large change in depth. Similarly, if the disparity value is big, then large changes in disparity do not lead to a large change in depth.
296296

@@ -339,7 +339,7 @@ Examples for calculating the depth value, using the OAK-D (7.5cm baseline):
339339
Note the value of disparity depth data is stored in :code:`uint16`, where 0 is a special value, meaning that distance is unknown.
340340

341341
Min stereo depth distance
342-
#########################
342+
=========================
343343

344344
If the depth results for close-in objects look weird, this is likely because they are below the minimum depth-perception distance of the device.
345345

@@ -375,8 +375,18 @@ or roughly 35cm.
375375

376376
See `these examples <https://github.com/luxonis/depthai-experiments/tree/master/gen2-camera-demo#real-time-depth-from-depthai-stereo-pair>`__ for how to enable Extended Disparity.
377377

378+
Disparity shift to lower min depth perception
379+
---------------------------------------------
380+
381+
Another option to perceive closer depth range is to use disparity shift. Disparity shift will shift the starting point
382+
of the disparity search, which will significantly decrease max depth perception, but it will also decrease min depth perception.
383+
384+
.. doxygenfunction:: dai::StereoDepthConfig::setDisparityShift
385+
:project: depthai-core
386+
:no-link:
387+
378388
Max stereo depth distance
379-
#########################
389+
=========================
380390

381391
The maximum depth perception distance depends on the :ref:`accuracy of the depth perception <Depth perception accuracy>`. The formula used to calculate this distance is an approximation, but is as follows:
382392

@@ -397,7 +407,7 @@ So using this formula for existing models the *theoretical* max distance is:
397407
If greater precision for long range measurements is required, consider enabling Subpixel Disparity or using a larger baseline distance between mono cameras. For a custom baseline, you could consider using `OAK-FFC <https://docs.luxonis.com/projects/hardware/en/latest/pages/DM1090.html>`__ device or design your own baseboard PCB with required baseline. For more information see Subpixel Disparity under the Stereo Mode tab in :ref:`this table <Currently configurable blocks>`.
398408

399409
Depth perception accuracy
400-
#########################
410+
=========================
401411

402412
Disparity depth works by matching features from one image to the other and its accuracy is based on multiple parameters:
403413

@@ -415,7 +425,7 @@ Lower baseline enables us to detect the depth at a closer distance as long as th
415425
So the common norm is to adjust the baseline according to how far/close we want to be able to detect objects.
416426

417427
Limitation
418-
##########
428+
==========
419429

420430
Since depth is calculated from disparity, which requires the pixels to overlap, there is inherently a vertical
421431
band on the left side of the left mono camera and on the right side of the right mono camera, where depth
@@ -472,7 +482,7 @@ forum post.
472482
`here <https://github.com/luxonis/depthai-hardware/issues/114>`__.
473483

474484
Measuring real-world object dimensions
475-
######################################
485+
======================================
476486

477487
Because the depth map contains the Z distance, objects in parallel with the camera are measured accurately standard. For objects not in parallel, the Euclidean distance calculation can be used. Please refer to the below:
478488

0 commit comments

Comments
 (0)