Stereo Preview¶
This example shows how to display WLS filtered disparity map using OpenCV.
Note
Visualization in current example is done with blocking behavor. This means that the program will halt at oak.start()
until the window is closed.
This is done to keep the example simple. For more advanced usage, see Blocking behavior section.
Setup¶
Please run the install script to download all required dependencies. Please note that this script must be ran from git context, so you have to download the depthai repository first and then run the script
git clone https://github.com/luxonis/depthai.git
cd depthai/
python3 install_requirements.py
For additional information, please follow our installation guide.
Pipeline¶
Source Code¶
Also available on GitHub.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import cv2 from depthai_sdk import OakCamera from depthai_sdk.components.stereo_component import WLSLevel from depthai_sdk.visualize.configs import StereoColor with OakCamera() as oak: stereo = oak.create_stereo('800p', fps=30) # Configure postprocessing (done on host) stereo.config_postprocessing(colorize=StereoColor.RGBD, colormap=cv2.COLORMAP_MAGMA) stereo.config_wls(wls_level=WLSLevel.MEDIUM) # WLS filtering, use for smoother results oak.visualize(stereo.out.depth) oak.start(blocking=True) |