First steps with DepthAI

This guide will go through the first steps with OAK camera and DepthAI library:

  1. Installing DepthAI

  2. Device setup - connecting the OAK camera to your host computer

  3. Running DepthAI Demo a Python-based GUI application

  4. Next steps; examples, demos, API docs

Installing DepthAI

Follow instructions below to install DepthAI (and its dependencies/requirements) with an installer.

Execute the script below to install DepthAI on macOS:

bash -c "$(curl -fL https://docs.luxonis.com/install_depthai.sh)"

Please refer to this documentation if any issues occur.

Windows 10/11 users can install DepthAI with the Windows Installer. After installer finishes, you can directly run the DepthAI application from the list of applications, which will run the DepthAI demo. You can skip Setup section (as Installer performs the whole setup) of this tutorial and go directly to Default run.

Execute the script below to install DepthAI on Linux systems:

sudo wget -qO- https://docs.luxonis.com/install_depthai.sh | bash

Please refer to Installation documentation if any issues occur.

If you would like to avoid using installer and would prefer manually installing dependencies, requirements and DepthAI, see Manual DepthAI installation.

Device setup

Now that we have installed requirements, we can setup the device. OAK cameras can be separated into two categories depending on how you connect to them; either via ethernet (OAK PoE cameras) or via USB (all others).

If your OAK came with an included USB cable, we suggest using that to connect the OAK camera to the host computer.

Warning

Make sure to use USB3 cable, as this is has been a very common culprit of OAK connectivity issues. If you aren’t using USB3 cable, force USB2 communication.

../../../_images/usb3.png

USB3 cable is colored blue in the inside of the USB-A connector of the USB-C cable. If it’s not blue, it might be USB2 charging cable.

Make sure that the device is connected to your host (which can be a PC or Raspberry Pi or another capable computer) directly to a USB3 port, or via a powered USB hub.

If you are using OAK PoE device, you will first need to connect the device to a PoE switch or a PoE injector. We recommend following the Getting started with OAK PoE devices for a step-by-step tutorial.

Default run

After installer finishes, it should automatically run the DepthAI Demo script. You can also manually run with command below:

$ python3 depthai_demo.py

Running the demo for the first time, the script will compile and download a default mobilenet-ssd model, configure the OAK camera and then show a default color preview that will contain a scaled preview from the RGB camera from your device.

Default run

Change preview

To see other previews from the device, you can use the preview switcher that is visible in the top-left section of the GUI

preview selector location
Available previews

Name

Description

Limitations

color

Shows preview from color camera

nnInput

Shows preview from right mono camera

Disabled if no AI model is running

left

Shows preview from left mono camera

Stereo required

right

Shows preview from right mono camera

Stereo required

depth

Shows disparity map calculated from depthRaw preview and JET colored. Best for visualizing depth

Stereo required

depthRaw

Shows raw depth map. Best for depth-based calculations

Stereo required

disparity

Shows disparity map produced on device

Stereo required

disparityColor

Shows disparity map produced on device and JET colored. Should be the same as depth preview but produced on the device.

Stereo required

rectifiedLeft

Rectified left camera frames

Stereo required

rectifiedRight

Rectified right camera frames

Stereo required

Default model

While the demo was running, you could see the detection results - and if you were standing in front of the camera, you should see yourself detected as a person with a pretty high probability.

The model that is used by default is a MobileNetv2 SSD object detector trained on the PASCAL 2007 VOC classes, which are:

  • Person: person

  • Animal: bird, cat, cow, dog, horse, sheep

  • Vehicle: airplane, bicycle, boat, bus, car, motorbike, train

  • Indoor: bottle, chair, dining table, potted plant, sofa, TV/monitor

So give it a try to detect different objects, like bottles or apples

bottles and apples

Note

See for DepthAI Demo additional documentation about DepthAI demo.

Next steps

In the previous sections, we learned how to preview basic DepthAI features. From this point, you can explore the DepthAI world further

Got questions?

We’re always happy to help with development or other questions you might have.