You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Examples for calculating the depth value, using the OAK-D (7.5cm baseline OV9282), for 400P resolution and disparity of 50 pixels:
42
+
43
+
.. math::
44
+
45
+
depth = 441.25 * 7.5 / 50 = 66.19 cm
39
46
40
47
`RVC2 <https://docs.luxonis.com/projects/hardware/en/latest/pages/rvc/rvc2.html>`__-based cameras have a **0..95 disparity search** range,
41
48
which limits the minimal depth perception. Baseline is the distance between two cameras of the
@@ -280,22 +287,27 @@ Stereo subpixel effect on layering
280
287
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
281
288
282
289
Default stereo depth output has 0..95 disparity pixels, which would produce 96 unique depth values. This can especially be seen when using pointcloud representation
283
-
and seeing how there are discrete "layers" of points, instead of a smooth transition:
290
+
and seeing how there are discrete "layers" of points, instead of a smooth transition:
This layering can especially be seen at longer distances, where these layers are exponentially further apart.
288
295
289
296
But with Stereo Subpixel mode enabled, there are many more unique values possible, which produces more granular depth steps, and thus smoother a pointcloud.
290
297
298
+
.. code-block:: python
299
+
300
+
# Number of unique values based on subpixel bits setting.
One can change the number of subpixel bits by setting ``stereoDepth.setSubpixelFractionalBits(int)`` parameter to 3, 4 or 5 bits.
301
313
@@ -317,10 +329,10 @@ Going back to :ref:`Depth from disparity`, minimal depth perception (**MinZ**) i
317
329
(maximum number of pixel for disparity search):
318
330
319
331
.. math::
320
-
depth = focal_length * baseline / disparity
332
+
depth = focalLength * baseline / disparity
321
333
322
334
.. math::
323
-
MinZ = focal_length * baseline / 95
335
+
MinZ = focalLength * baseline / 95
324
336
325
337
How to get lower MinZ
326
338
---------------------
@@ -343,10 +355,10 @@ Above we have a formula for MinZ, and by lowering the resolution, we are lowerin
343
355
MinZ = focalLength * baseline / 95
344
356
345
357
.. math::
346
-
MinZ [800P OAK-D] = 882.5 * 7.5 / 95 = 70 cm
358
+
MinZ [800P] = 882.5 * 7.5 / 95 = 70 cm
347
359
348
360
.. math::
349
-
MinZ [400P OAK-D] = 441 * 7.5 / 95 = 35 cm
361
+
MinZ [400P] = 441 * 7.5 / 95 = 35 cm
350
362
351
363
As you can see, by lowering resolution by 2, we are also lowering MinZ by 2. Note that because you have fewer pixels, you will also have lower depth accuracy (in cm).
352
364
@@ -431,7 +443,7 @@ That gives the following formula:
431
443
B = 2 * Dv * tan(HFOV/2) * W / (2 * D * tan(HFOV/2))
432
444
433
445
.. math::
434
-
B = W * Dv / D # pixels
446
+
B [pixels] = W * Dv / D
435
447
436
448
Example: If we are using OAK-D, which has a HFOV of 72°, a baseline (:code:`BL`) of 7.5 cm and
437
449
640x400 (400P) resolution is used, therefore :code:`W = 640` and an object is :code:`D = 100` cm away, we can
@@ -440,7 +452,7 @@ calculate :code:`B` in the following way:
440
452
.. math::
441
453
442
454
Dv = 7.5 / 2 * tan(90 - 72/2) = 3.75 * tan(54°) = 5.16 cm
443
-
B = 640 * 5.16 / 100 = 33 # pixels
455
+
B = 640 * 5.16 / 100 = 33
444
456
445
457
Credit for calculations and images goes to our community member gregflurry, which he made on
0 commit comments