Software Stack
DepthAI

ON THIS PAGE

  • Display all cameras
  • Pipeline
  • Source code

Display all cameras

Display all camera streams on the host using OpenCV. It uses the Camera node to get camera streams in highest resolution available (using cam.requestFullResolutionOutput()).This example requires the DepthAI v3 API, see installation instructions.

Pipeline

Source code

Python
C++

Python

Python
GitHub
1#!/usr/bin/env python3
2
3import cv2
4import depthai as dai
5
6# Create pipeline
7device = dai.Device()
8with dai.Pipeline(device) as pipeline:
9    outputQueues = {}
10    sockets = device.getConnectedCameras()
11    for socket in sockets:
12        cam = pipeline.create(dai.node.Camera).build(socket)
13        outputQueues[str(socket)] = cam.requestFullResolutionOutput().createOutputQueue()
14
15    pipeline.start()
16    while pipeline.isRunning():
17        for name in outputQueues.keys():
18            queue = outputQueues[name]
19            videoIn = queue.get()
20            assert isinstance(videoIn, dai.ImgFrame)
21            # Visualizing the frame on slower hosts might have overhead
22            cv2.imshow(name, videoIn.getCvFrame())
23
24        if cv2.waitKey(1) == ord("q"):
25            break

Need assistance?

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