|
1 | 1 | StereoDepth |
2 | 2 | =========== |
3 | 3 |
|
4 | | -Stereo depth node calculates the dispartiy/depth from two :ref:`mono cameras <MonoCamera>`. |
| 4 | +Stereo depth node calculates the disparity/depth from two :ref:`mono cameras <MonoCamera>`. |
5 | 5 |
|
6 | 6 | How to place it |
7 | 7 | ############### |
@@ -74,54 +74,115 @@ If one or more of the additional depth modes (:code:`lrcheck`, :code:`extended`, |
74 | 74 |
|
75 | 75 | Otherwise, :code:`depth` output is **U16** (in millimeters) and median is functional. |
76 | 76 |
|
77 | | -Depth Modes |
78 | | -########### |
| 77 | +Stereo depth FPS |
| 78 | +################ |
79 | 79 |
|
80 | | -Left-Right Check |
81 | | -**************** |
| 80 | +.. list-table:: |
| 81 | + :header-rows: 1 |
82 | 82 |
|
83 | | -Left-Right Check or LR-Check is used to remove incorrectly calculated disparity pixels due to occlusions at object borders (Left and Right camera views |
84 | | -are slightly different). |
| 83 | + * - Stereo depth mode |
| 84 | + - FPS for 720P |
| 85 | + * - Standard mode |
| 86 | + - 150 |
| 87 | + * - Left-Right Check |
| 88 | + - 60 |
| 89 | + * - Subpixel Disparity |
| 90 | + - 30 |
| 91 | + * - Extended Disparity |
| 92 | + - 60 |
| 93 | + * - Subpixel + LR check |
| 94 | + - 15 |
| 95 | + * - Extended + LR check |
| 96 | + - 30 |
85 | 97 |
|
86 | | -#. Computes disparity by matching in R->L direction |
87 | | -#. Computes disparity by matching in L->R direction |
88 | | -#. Combines results from 1 and 2, running on Shave: each pixel d = disparity_LR(x,y) is compared with disparity_RL(x-d,y). If the difference is above a threshold, the pixel at (x,y) in the final disparity map is invalidated. |
| 98 | +Internal block diagram of StereoDepth node |
| 99 | +########################################## |
89 | 100 |
|
90 | | -Extended Disparity |
91 | | -****************** |
| 101 | +.. image:: /_static/images/components/depth_diagram.jpeg |
| 102 | + :target: https://whimsical.com/stereo-node-EKcfcXGjGpNL6cwRPV6NPv |
92 | 103 |
|
93 | | -The :code:`extended disparity` allows detecting closer distance objects for the given baseline. This increases the maximum disparity search from 96 to 191. |
94 | | -So this cuts the minimum perceivable distance in half, given that the minimum distance is now :code:`focal_length * base_line_dist / 190` instead |
95 | | -of :code:`focal_length * base_line_dist / 95`. |
| 104 | +On the diagram, red rectangle are firmware settings that are configurable via the API. Gray rectangles are settings that that are not yet |
| 105 | +exposed to the API. We plan on exposing as much configurability as possible, but please inform us if you would like to see these settings |
| 106 | +configurable sooner. |
96 | 107 |
|
97 | | -#. Computes disparity on the original size images (e.g. 1280x720) |
98 | | -#. Computes disparity on 2x downscaled images (e.g. 640x360) |
99 | | -#. Combines the two level disparities on Shave, effectively covering a total disparity range of 191 pixels (in relation to the original resolution). |
| 108 | +If you click on the image, you will be redirected to the webapp. Some blocks have notes that provide additional technical information. |
100 | 109 |
|
101 | | -Subpixel Disparity |
102 | | -****************** |
| 110 | +Currently configurable blocks |
| 111 | +***************************** |
103 | 112 |
|
104 | | -Subpixel improves the precision and is especially useful for long range measurements. It also helps for better estimating surface normals |
| 113 | +.. tabs:: |
| 114 | + |
| 115 | + .. tab:: Stereo Mode |
| 116 | + |
| 117 | + .. tabs:: |
| 118 | + |
| 119 | + .. tab:: Left-Right Check |
| 120 | + |
| 121 | + Left-Right Check or LR-Check is used to remove incorrectly calculated disparity pixels due to occlusions at object borders (Left and Right camera views |
| 122 | + are slightly different). |
| 123 | + |
| 124 | + #. Computes disparity by matching in R->L direction |
| 125 | + #. Computes disparity by matching in L->R direction |
| 126 | + #. Combines results from 1 and 2, running on Shave: each pixel d = disparity_LR(x,y) is compared with disparity_RL(x-d,y). If the difference is above a threshold, the pixel at (x,y) in the final disparity map is invalidated. |
| 127 | + |
| 128 | + .. tab:: Extended Disparity |
| 129 | + |
| 130 | + The :code:`extended disparity` allows detecting closer distance objects for the given baseline. This increases the maximum disparity search from 96 to 191. |
| 131 | + So this cuts the minimum perceivable distance in half, given that the minimum distance is now :code:`focal_length * base_line_dist / 190` instead |
| 132 | + of :code:`focal_length * base_line_dist / 95`. |
| 133 | + |
| 134 | + #. Computes disparity on the original size images (e.g. 1280x720) |
| 135 | + #. Computes disparity on 2x downscaled images (e.g. 640x360) |
| 136 | + #. Combines the two level disparities on Shave, effectively covering a total disparity range of 191 pixels (in relation to the original resolution). |
| 137 | + |
| 138 | + .. tab:: Subpixel Disparity |
| 139 | + |
| 140 | + Subpixel improves the precision and is especially useful for long range measurements. It also helps for better estimating surface normals |
| 141 | + |
| 142 | + Besides the integer disparity output, the Stereo engine is programmed to dump to memory the cost volume, that is 96 levels (disparities) per pixel, |
| 143 | + then software interpolation is done on Shave, resulting a final disparity with 5 fractional bits, resulting in significantly more granular depth |
| 144 | + steps (32 additional steps between the integer-pixel depth steps), and also theoretically, longer-distance depth viewing - as the maximum depth |
| 145 | + is no longer limited by a feature being a full integer pixel-step apart, but rather 1/32 of a pixel. |
105 | 146 |
|
106 | | -Besides the integer disparity output, the Stereo engine is programmed to dump to memory the cost volume, that is 96 levels (disparities) per pixel, |
107 | | -then software interpolation is done on Shave, resulting a final disparity with 5 fractional bits, resulting in significantly more granular depth |
108 | | -steps (32 additional steps between the integer-pixel depth steps), and also theoretically, longer-distance depth viewing - as the maximum depth |
109 | | -is no longer limited by a feature being a full integer pixel-step apart, but rather 1/32 of a pixel. |
| 147 | + For comparison of normal disparity vs. subpixel disparity images, click `here <https://github.com/luxonis/depthai/issues/184>`__. |
| 148 | + |
| 149 | + .. tab:: Mesh file / Homography matrix |
| 150 | + |
| 151 | + Mesh files are generated using the camera intrinsics, distortion coeffs, and rectification rotations. |
| 152 | + These files helps in overcoming the distortions in the camera increasing the accuracy and also help in when `wide FOV <https://docs.luxonis.com/projects/hardware/en/latest/pages/arducam.html#arducam-compatible-cameras>`__ lens are used. |
| 153 | + |
| 154 | + .. note:: |
| 155 | + Currently mesh files are generated only for stereo cameras on the host during calibration. The generated mesh files are stored in `depthai/resources <https://github.com/luxonis/depthai/tree/main/resources>`__ which users can load to the device. This process will be moved to on device in the upcoming releases. |
| 156 | + |
| 157 | + .. doxygenfunction:: dai::node::StereoDepth::loadMeshFiles |
| 158 | + :project: depthai-core |
| 159 | + :no-link: |
| 160 | + |
| 161 | + .. doxygenfunction:: dai::node::StereoDepth::loadMeshData |
| 162 | + :project: depthai-core |
| 163 | + :no-link: |
| 164 | + |
| 165 | + .. doxygenfunction:: dai::node::StereoDepth::setMeshStep |
| 166 | + :project: depthai-core |
| 167 | + :no-link: |
| 168 | + |
| 169 | + .. tab:: Confidence Threshold |
| 170 | + |
| 171 | + - **Confidence threshold**: Stereo depth algorithm searches for the matching feature from right camera point to the left image (along the 96 dispairty levels). During this process it computes the cost for each disparity level and choses the minimal cost between two disparities and uses it to compute the confidence at each pixel. Stereo node will output disparity/depth pixels only where depth confidence is below the **confidence threshold** (lower the confidence value means better depth accuracy). Note: This threshold only applies to Normal stereo mode as of now. |
| 172 | + - **LR check threshold**: Disparity is considered for the output when the difference between LR and RL disparities is smaller than the LR check threshold. |
| 173 | + |
| 174 | + .. doxygenfunction:: dai::StereoDepthConfig::setConfidenceThreshold |
| 175 | + :project: depthai-core |
| 176 | + :no-link: |
| 177 | + |
| 178 | + .. doxygenfunction:: dai::StereoDepthConfig::setLeftRightCheckThreshold |
| 179 | + :project: depthai-core |
| 180 | + :no-link: |
110 | 181 |
|
111 | | -For comparison of normal disparity vs. subpixel disparity images, click `here <https://github.com/luxonis/depthai/issues/184>`__. |
112 | 182 |
|
113 | 183 | Usage |
114 | 184 | ##### |
115 | 185 |
|
116 | | -.. |
117 | | - COnfigure different: |
118 | | - -median |
119 | | - -raw_depth |
120 | | - -rectified |
121 | | - -lr_check |
122 | | - -ext_disparity |
123 | | - -subpixel |
124 | | -
|
125 | 186 | .. tabs:: |
126 | 187 |
|
127 | 188 | .. code-tab:: py |
|
0 commit comments