I have five cameras.

I took the multiple camera example and here are the errors:

c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python>python multipleDevices.py

===Connected to 18443010B1C8690F00

MXID: 18443010B1C8690F00

Num of cameras: 1

USB speed: UsbSpeed.SUPER

Board name: OAK-1

←[31mF: [global] [ 0] [ThreadN] dispatcherResponseServe:928 no request for this response: XLINK_READ_REL_RESP 1

←[0m

[18443010B1C8690F00] [1.1.1.1] [1731631485.297] [host] [warning] Device crashed, but no crash dump could be extracted.

Then I have written a few of my own codes to try to talk to multiple cameras. Here is the code:

#!/usr/bin/env python3

#

# Show image from two cameras

#

import cv2

import depthai as dai

# List all the cameras available

idev = 0

for device in dai.Device.getAllAvailableDevices():

print(f"{device.name} {device.getMxId()} {device.state}")

idev = idev + 1

# Need at least two cameras.

if idev < 2:

print( "Found {idev} cameras. Need at least two cameras." )

# Create pipeline

pipeline1 = dai.Pipeline()

pipeline2 = dai.Pipeline()

# Define source and output

camRgb1 = pipeline1.create(dai.node.ColorCamera)

camRgb2 = pipeline2.create(dai.node.ColorCamera)

xoutVideo1 = pipeline1.create(dai.node.XLinkOut)

xoutVideo2 = pipeline2.create(dai.node.XLinkOut)

xoutVideo1.setStreamName("video1")

xoutVideo2.setStreamName("video2")

# Properties

camRgb1.setBoardSocket(dai.CameraBoardSocket.CAM_A)

camRgb1.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)

camRgb1.setVideoSize(1920, 1080)

camRgb2.setBoardSocket(dai.CameraBoardSocket.CAM_A)

camRgb2.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)

camRgb2.setVideoSize(1920, 1080)

xoutVideo1.input.setBlocking(False)

xoutVideo2.input.setQueueSize(1)

xoutVideo1.input.setBlocking(False)

xoutVideo2.input.setQueueSize(1)

# Linking

camRgb1.video.link(xoutVideo1.input)

camRgb2.video.link(xoutVideo2.input)

# Connect to device and start pipeline

camera = dai.Device.getAllAvailableDevices()

device_info1 = dai.DeviceInfo(camera[0].getMxId()) # MXID

device_info2 = dai.DeviceInfo(camera[1].getMxId())

with dai.Device(pipeline1, device_info1) as device1:

with dai.Device(pipeline2, device_info2) as device2:

    video1 = device1.getOutputQueue(name="video1", maxSize=1, blocking=False)

    video2 = device2.getOutputQueue(name="video2", maxSize=1, blocking=False)

    

    cnt = 0

    while True:

        videoIn1 = video1.get()

        videoIn2 = video2.get()

        # Get BGR frame from NV12 encoded video frame to show with opencv

        # Visualizing the frame on slower hosts might have overhead

        cv2.imshow("video1", videoIn1.getCvFrame())

        cv2.imshow("video2", videoIn2.getCvFrame())      

        if cnt == 0:

            cv2.resizeWindow( "video1", 200, 200 )

            cv2.resizeWindow( "video2", 200, 200 )

            cv2.moveWindow( "video1", 100, 100 )

            cv2.moveWindow( "video2", 300, 100 )



        cnt = cnt + 1

        if cv2.waitKey(100) == ord('q'):

            break

I did see two windows come up. Here are the error messages:

c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python>python vid2.py

1.1.1.1 18443010B1C8690F00 XLinkDeviceState.X_LINK_UNBOOTED

1.1.1.2 18443010A175680F00 XLinkDeviceState.X_LINK_UNBOOTED

1.1.3 18443010E109690F00 XLinkDeviceState.X_LINK_UNBOOTED

1.1.4 1844301081D1650F00 XLinkDeviceState.X_LINK_UNBOOTED

1.1.2 1844301081D4650F00 XLinkDeviceState.X_LINK_UNBOOTED

c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python\vid2.py:58: DeprecationWarning: Use constructor taking 'UsbSpeed' instead

with dai.Device(pipeline1, device_info1) as device1:

c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python\vid2.py:59: DeprecationWarning: Use constructor taking 'UsbSpeed' instead

with dai.Device(pipeline2, device_info2) as device2:

←[31mF: [global] [ 0] [ThreadN] dispatcherResponseServe:928 no request for this response: XLINK_READ_REL_RESP 1

←[0m

[18443010A175680F00] [1.1.1.2] [1731631676.974] [host] [warning] Device crashed, but no crash dump could be extracted.

Traceback (most recent call last):

File "c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python\vid2.py", line 68, in <module>

videoIn2 = video2.get()

           ^^^^^^^^^^^^

RuntimeError: Communication exception - possible device error/misconfiguration. Original message 'Couldn't read data from stream: 'video2' (X_LINK_ERROR)'

  • Good results! I now have a suitable power supply, and all five cameras are working.

    Thank you for all your help.

I was trying to work with each camera in a different process. Plugging in the second camera seems to break the code that is reading from the first camera

@python a1.py 0 300 300 100 100

0 300 300 100 100

[2024-11-14 17:10:51.910] [depthai] [warning] skipping X_LINK_UNBOOTED device having name "1.1.1.1"

[2024-11-14 17:10:51.913] [depthai] [warning] skipping X_LINK_UNBOOTED device having name "1.1.4"

[2024-11-14 17:10:51.916] [depthai] [warning] skipping X_LINK_UNBOOTED device having name "1.1.2"

1.1.1.2 18443010A175680F00 XLinkDeviceState.X_LINK_UNBOOTED

1.1.3 18443010E109690F00 XLinkDeviceState.X_LINK_UNBOOTED

[2024-11-14 17:10:52.713] [depthai] [warning] skipping X_LINK_UNBOOTED device having name "1.1.1.1"

c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python\diff5\a1.py:47: DeprecationWarning: Use constructor taking 'UsbSpeed' instead

with dai.Device(pipeline, device_info1) as device:

Traceback (most recent call last):

File "c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python\diff5\a1.py", line 47, in <module>

with dai.Device(pipeline, device_info1) as device:

     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

RuntimeError: Failed to boot device!

@python a1.py 0 400 400 100 100

0 400 400 100 100

1.1.3 18443010E109690F00 XLinkDeviceState.X_LINK_UNBOOTED

c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python\diff5\a1.py:47: DeprecationWarning: Use constructor taking 'UsbSpeed' instead

with dai.Device(pipeline, device_info1) as device:

[18443010E109690F00] [1.1.3] [1731633175.574] [host] [warning] Device crashed, but no crash dump could be extracted.

Traceback (most recent call last):

File "c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python\diff5\a1.py", line 53, in <module>

videoIn = video.get()

          ^^^^^^^^^^^

RuntimeError: Communication exception - possible device error/misconfiguration. Original message 'Couldn't read data from stream: 'video' (X_LINK_ERROR)'

@

#!/usr/bin/env python3

import cv2

import depthai as dai

import sys

args = sys.argv;

cam = int(args[1]);

wx = int(args[2])

wy = int(args[3])

ox = int(args[4])

oy = int(args[5])

print( f"{cam} {wx} {wy} {ox} {oy}")

# List all the cameras available

idev = 0

for device in dai.Device.getAllAvailableDevices():

print(f"{device.name} {device.getMxId()} {device.state}")

idev = idev + 1

# Create pipeline

pipeline = dai.Pipeline()

# Define source and output

camRgb = pipeline.create(dai.node.ColorCamera)

xoutVideo = pipeline.create(dai.node.XLinkOut)

xoutVideo.setStreamName("video")

# Properties

camRgb.setBoardSocket(dai.CameraBoardSocket.CAM_A)

camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)

camRgb.setVideoSize(1920, 1080)

xoutVideo.input.setBlocking(False)

xoutVideo.input.setQueueSize(1)

# Linking

camRgb.video.link(xoutVideo.input)

# Connect to device and start pipeline

camera = dai.Device.getAllAvailableDevices()

device_info1 = dai.DeviceInfo(camera[cam].getMxId()) # MXID

# Connect to device and start pipeline

with dai.Device(pipeline, device_info1) as device:

video = device.getOutputQueue(name="video", maxSize=1, blocking=False)

cnt = 0



while True:

    videoIn = video.get()

    # Get BGR frame from NV12 encoded video frame to show with opencv

    # Visualizing the frame on slower hosts might have overhead

    cv2.imshow("video", videoIn.getCvFrame())

    if cnt == 0:

        cv2.resizeWindow( "video", wx, wy )

        cv2.moveWindow( "video", ox, oy )

    cnt = cnt + 1

    if cv2.waitKey(100) == ord('q'):

        print( "Finished.")

        break

    The main.py script doesn't help. All the cameras are available and then main.py has errors and never displays an image

    //

    // Here are the results from these lines of code

    for device in dai.Device.getAllAvailableDevices():

    print(f"{device.name} {device.getMxId()} {device.state}")

    1.1.1.1 1844301081D4650F00 XLinkDeviceState.X_LINK_UNBOOTED

    1.1.1.2 18443010B1C8690F00 XLinkDeviceState.X_LINK_UNBOOTED

    1.1.1.4 18443010A175680F00 XLinkDeviceState.X_LINK_UNBOOTED

    1.1.3 18443010E109690F00 XLinkDeviceState.X_LINK_UNBOOTED

    1.1.2 1844301081D1650F00 XLinkDeviceState.X_LINK_UNBOOTED

    //

    // Here are results from main.py

    //

    c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python>python main.py

    Found 5 devices

    c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python\main.py:38: DeprecationWarning: Use constructor taking 'UsbSpeed' instead

    device: dai.Device = stack.enter_context(dai.Device(openvino_version, dev_info, False))

    Exception in thread Thread-2 (worker):

    Exception in thread Thread-3 (worker):

    Traceback (most recent call last):

    File "C:\Users\tonya\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1045, in _bootstrap_inner

    Traceback (most recent call last):

    File "C:\Users\tonya\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1045, in _bootstrap_inner

    self.run()

    File "C:\Users\tonya\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 982, in run

    self.run()

    File "C:\Users\tonya\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 982, in run

    self._target(\*self._args, \*\*self._kwargs)

    File "c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python\main.py", line 38, in worker

    self._target(\*self._args, \*\*self._kwargs)

    File "c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python\main.py", line 38, in worker

    device: dai.Device = stack.enter_context(dai.Device(openvino_version, dev_info, False))
    
    device: dai.Device = stack.enter_context(dai.Device(openvino_version, dev_info, False))
    
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    RuntimeError: Failed to boot device!

                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    RuntimeError: Failed to boot device!

    Exception in thread Thread-5 (worker):

    Traceback (most recent call last):

    File "C:\Users\tonya\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1045, in _bootstrap_inner

    self.run()

    File "C:\Users\tonya\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 982, in run

    self._target(\*self._args, \*\*self._kwargs)

    File "c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python\main.py", line 38, in worker

    device: dai.Device = stack.enter_context(dai.Device(openvino_version, dev_info, False))
    
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    RuntimeError: Failed to boot device!

    Exception in thread Thread-1 (worker):

    Traceback (most recent call last):

    File "C:\Users\tonya\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1045, in _bootstrap_inner

    self.run()

    File "C:\Users\tonya\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 982, in run

    self._target(\*self._args, \*\*self._kwargs)

    File "c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python\main.py", line 38, in worker

    device: dai.Device = stack.enter_context(dai.Device(openvino_version, dev_info, False))
    
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    RuntimeError: Failed to find device (1.1.1.1), error message: X_LINK_DEVICE_NOT_FOUND

    Exception in thread Thread-4 (worker):

    Traceback (most recent call last):

    File "C:\Users\tonya\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1045, in _bootstrap_inner

    self.run()

    File "C:\Users\tonya\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 982, in run

    self._target(\*self._args, \*\*self._kwargs)

    File "c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python\main.py", line 38, in worker

    device: dai.Device = stack.enter_context(dai.Device(openvino_version, dev_info, False))
    
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    RuntimeError: Failed to find device (1.1.3), error message: X_LINK_DEVICE_NOT_FOUND

    Inconsistent results all day

    \Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python\diff5>python a1.py 0 100 100

    0 100 100

    1.1.1.1 1844301081D4650F00 XLinkDeviceState.X_LINK_UNBOOTED

    1.1.3 1844301081D1650F00 XLinkDeviceState.X_LINK_UNBOOTED

    Connecting to 0 with MxID 1844301081D4650F00

    c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python\diff5\a1.py:52: DeprecationWarning: Use constructor taking 'UsbSpeed' instead

    with dai.Device(pipeline, device_info1) as device:

    Traceback (most recent call last):

    File "c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python\diff5\a1.py", line 52, in <module>

    with dai.Device(pipeline, device_info1) as device:
    
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    RuntimeError: Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND

    c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python\diff5>python a1.py 0 100 100

    0 100 100

    1.1.1.1 1844301081D4650F00 XLinkDeviceState.X_LINK_UNBOOTED

    Connecting to 0 with MxID 1844301081D4650F00

    c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python\diff5\a1.py:52: DeprecationWarning: Use constructor taking 'UsbSpeed' instead

    with dai.Device(pipeline, device_info1) as device:

    Traceback (most recent call last):

    File "c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python\diff5\a1.py", line 52, in <module>

    with dai.Device(pipeline, device_info1) as device:
    
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    RuntimeError: Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND

    c:\Users\tonya\OneDrive - Viewray Systems Inc\Documents\Python\diff5>

    Here is the script I am using, cant upload python??

    #!/usr/bin/env python3

    import cv2

    import depthai as dai

    import sys

    args = sys.argv;

    cam = int(args[1]);

    ox = int(args[2])

    oy = int(args[3])

    print( f"{cam} {ox} {oy}")

    # List all the cameras available

    idev = 0

    for device in dai.Device.getAllAvailableDevices():

    print(f"{device.name} {device.getMxId()} {device.state}")
    
    idev = idev + 1

    # Create pipeline

    pipeline = dai.Pipeline()

    # Define source and output

    camRgb = pipeline.create(dai.node.ColorCamera)

    xoutVideo = pipeline.create(dai.node.XLinkOut)

    xoutVideo.setStreamName("video")

    # Properties

    camRgb.setBoardSocket(dai.CameraBoardSocket.CAM_A)

    camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)

    camRgb.setVideoSize(1920, 1080)

    imageWidth = int(1920/2)

    imageHeight = int(1080/2)

    camRgb.setPreviewSize( imageWidth, imageHeight )

    # 300x300 will be the preview frame size, available as 'preview' output of the node

    camRgb.setInterleaved(False)

    xoutVideo.input.setBlocking(False)

    xoutVideo.input.setQueueSize(1)

    # Linking

    camRgb.preview.link(xoutVideo.input)

    # Connect to device and start pipeline

    camera = dai.Device.getAllAvailableDevices()

    device_info1 = dai.DeviceInfo(camera[cam].getMxId()) # MXID

    print( f"Connecting to {cam} with MxID {camera[cam].getMxId()}" )

    # Connect to device and start pipeline

    with dai.Device(pipeline, device_info1) as device:

    video = device.getOutputQueue(name="video", maxSize=1, blocking=False)
    
    cnt = 0
    
    
    
    while True:
    
        videoIn = video.get()
    
        # Get BGR frame from NV12 encoded video frame to show with opencv
    
        # Visualizing the frame on slower hosts might have overhead
    
        cv2.imshow("video", videoIn.getCvFrame())
    
        if cnt == 0:
    
            cv2.resizeWindow( "video", imageWidth, imageHeight )
    
            cv2.moveWindow( "video", ox, oy )
    
        cnt = cnt + 1
    
        if cv2.waitKey(100) == ord('q'):
    
            print( "Finished.")
    
            break

    jakaskerl Make sure you have adequate USB power supply

    Can you confirm?

    Thanks,
    Jaka

    Jaka,

    I cannot confirm. I am ordering a power supply and we can talk later in the week.

    I put a photo of my setup here.

      tonya
      Ok, this looks like the power is coming directly from the PC. LMK when you get a PS.

      Thanks,
      Jaka

      14 days later

      Good results! I now have a suitable power supply, and all five cameras are working.

      Thank you for all your help.