Stereo-Depth Modes
- Active Stereo
If there’s no texture in the images, the usual block-matching process for left-right correspondence does not work. To solve this issue, OAK Pro cameras have IR Laser Dot Projector which projects little dots on the scene and helps with stereo-matching algorithm.
with dai.Device(pipeline) as device: ############################# device.setIrLaserDotProjectorIntensity(0.5) # in %, from 0 to 1 ############################# # Continue...
- Extended Disparity - A solution for short-range stereo-depth
While matching left-right correspondance, the algorithm does not search through the whole line but just a section of the line since its computationally expensive. But, by increasing this disparity search width helps get depths of nearer objects too by adding some latency to our pipeline.
\[Z = \frac{f.B}{d}\]- where,
Z: depth
f: focal length
B: baseline
d: disparity
It can be seen that depth is inversely proportional to disparity. So, if disparity increases, then depth decreases.
pipeline = dai.Pipeline() stereo = pipeline.create(dai.node.StereoDepth) # Closer-in minimum depth, disparity range is doubled: stereo.setExtendedDisparity(True)
- Subpixel Disparity
Disparity not just discrete but can be in fraction of a pixel too, which improves precision for long-range measurements.
pipeline = dai.Pipeline() stereo = pipeline.create(dai.node.StereoDepth) # Better accuracy for longer distance, fractional disparity 32-levels: stereo.setSubpixel(True)
- Left-Right Check
Removes incorrectly calculated disparity pixels due to occlusions at object borders (Forward Mapping + Backward Check).
pipeline = dai.Pipeline() stereo = pipeline.create(dai.node.StereoDepth) # Better handling for occlusions: stereo.setLeftRightCheck(True)