The `depthai` Python library provides an API to interact with Luxonis OAK (OpenCV AI Kit) devices, enabling users to build sophisticated computer vision and AI applications with on-device processing. It supports various nodes for camera input, neural inference, depth estimation, and data output. The current version is 3.5.0, with a rapid release cadence introducing new features and improvements, often alongside firmware updates.
pip install depthaiVerified import paths — ran on the pinned version, not inferred.
This quickstart code initializes a DepthAI pipeline to capture a 1080p color stream from the OAK-D's RGB camera, resizes it to 300x300 for preview, and displays it using OpenCV. Ensure `opencv-python` is installed (`pip install opencv-python`).
Refer to the official DepthAI v2 to v3 migration guide on Luxonis documentation. Key changes include using `pipeline.create(dai.node.NodeName)` for node instantiation and updated setters for node properties (e.g., `setResolution` instead of `setPreviewSize`).
Ensure your OAK device firmware is updated to a compatible version using `python3 -m depthai.auto_update`. Check the release notes for your `depthai` version for recommended firmware.
Optimize pipeline design by using lower resolutions/framerate where possible, offloading processing to the host, or leveraging the device's hardware accelerators efficiently. Monitor CPU/memory usage on the device if available.
Be aware of this environment variable. If unexpected calibration behavior occurs, check if `DEPTHAI_AUTOCALIBRATION` is set in your environment. For explicit control, use the `dai.node.AutoCalibration` node in your pipeline.
Ensure the OAK device is properly connected to a USB 3.0 port and powered. Check USB cable integrity. On Linux, ensure correct udev rules are installed (e.g., `curl -fL https://docs.luxonis.com/install_dependencies.sh | bash`).
If upgrading from v2 to v3, consult the migration guide. For v3.x, instead of `setPreviewSize` for output, use `camRgb.setVideoSize(width, height)` for video stream or `camRgb.setStillSize(width, height)` for still images, or link `camRgb.preview` to an `ImageManip` node for custom scaling.
Refer to your OAK device's specifications for supported resolutions and framerates for each camera sensor. Adjust `camRgb.setResolution()` or `camMono.setResolution()` accordingly. Sometimes, lower framerates might enable higher resolutions.
Reduce bandwidth (lower resolution, framerate, or fewer streams). Update device firmware (`python3 -m depthai.auto_update`). Simplify the pipeline to isolate the problematic node or connection. Check logs for more specific errors if available.