DepthAI Tutorials
DepthAI API References

ON THIS PAGE

  • Device information
  • Demo
  • Setup
  • Source code

Device information

This example shows how you can query device information.The first part of the code queries all available devices without actually booting any device. For each found device, it prints the following information:
  • Device name: Either IP, in case of OAK PoE cameras, or USB path in case of OAK USB cameras
  • MxId: Unique Mx (chip) identification code
  • State: State of the device. Note that OAK PoE cameras have bootloader flashed which initializes the network stack
Afterwards, the example boots into the first found device and prints available camera sensors, and reads calibration and eeprom data which stores product and board names.

Demo

Command Line
1Searching for all available devices...
2
3Found device '1.3', MxId: '18443010D116631200', State: 'UNBOOTED'
4Found device '192.168.33.201', MxId: '184430102163DB0F00', State: 'BOOTLOADER'
5Found device '192.168.33.192', MxId: '1844301011F4C51200', State: 'BOOTLOADER'
6
7Booting the first available camera (1.3)...
8Available camera sensors:  {<CameraBoardSocket.CAM_C: 2>: 'OV9282', <CameraBoardSocket.CAM_A: 0>: 'IMX378', <CameraBoardSocket.CAM_B: 1>: 'OV9282'}
9Product name: OAK-D Pro AF, board name DM9098

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-python repository first and then run the script
Command Line
1git clone https://github.com/luxonis/depthai-python.git
2cd depthai-python/examples
3python3 install_requirements.py
For additional information, please follow the installation guide.

Source code

Python
C++

Python

Python
GitHub
1import depthai as dai
2from typing import List
3
4print('Searching for all available devices...\n')
5# Query all available devices (USB and POE OAK cameras)
6infos: List[dai.DeviceInfo] = dai.DeviceBootloader.getAllAvailableDevices()
7
8if len(infos) == 0:
9    print("Couldn't find any available devices.")
10    exit(-1)
11
12
13for info in infos:
14    # Converts enum eg. 'XLinkDeviceState.X_LINK_UNBOOTED' to 'UNBOOTED'
15    state = str(info.state).split('X_LINK_')[1]
16
17    print(f"Found device '{info.name}', MxId: '{info.mxid}', State: '{state}'")
18
19
20# Connect to a specific device. We will just take the first one
21print(f"\nBooting the first available camera ({infos[0].name})...")
22with dai.Device(dai.Pipeline(), infos[0], usb2Mode=False) as device:
23    print("Available camera sensors: ", device.getCameraSensorNames())
24    calib = device.readCalibration()
25    eeprom = calib.getEepromData()
26    print(f"Product name: {eeprom.productName}, board name {eeprom.boardName}")

Need assistance?

Head over to Discussion Forum for technical support or any other questions you might have.