This example shows how to use the DepthAI/megaAI/OAK cameras in the Gen2 Pipeline Builder over USB.
Unfiltered subpixel disparity depth results from a BW1092 board over USB2:
python3 install_requirements.py
Note: python3 install_requirements.py
also tries to install libs from requirements-optional.txt which are optional. For ex: it contains open3d lib which is necessary for point cloud visualization. However, this library's binaries are not available for some hosts like raspberry pi and jetson.
python3 main.py
- Runs without point cloud visualization
python3 main.py -pcl
- Enables point cloud visualization
This will run subpixel disparity by default.
StereoDepth configuration options:
lrcheck = True # Better handling for occlusions
extended = False # Closer-in minimum depth, disparity range is doubled
subpixel = True # Better accuracy for longer distance, fractional disparity 32-levels
If one or more of the additional depth modes (lrcheck, extended, subpixel) are enabled, then:
- depth output is FP16. TODO enable U16.
- median filtering is disabled on device. TODO enable.
- with subpixel, either depth or disparity has valid data.
Otherwise, depth output is U16 (mm) and median is functional. But like on Gen1, either depth or disparity has valid data. TODO enable both.
Select one pipeline to run:
#pipeline, streams = create_rgb_cam_pipeline()
#pipeline, streams = create_mono_cam_pipeline()
pipeline, streams = create_stereo_depth_pipeline()
Set source_camera = False
Using input images from: https://vision.middlebury.edu/stereo/data/scenes2014/
For the bad looking areas, these are caused by the objects being too close to the camera for the given baseline, exceeding the 96 pixels max distance for disparity matching (StereoDepth engine constraint):
These areas will be improved with extended = True
, however Extended Disparity and Subpixel cannot operate both at the same time.