# Display all cameras

Display all camera streams on the host using OpenCV. It uses the
[Camera](https://docs.luxonis.com/software-v3/depthai/depthai-components/nodes/camera.md) node to get camera streams in highest
resolution available (using cam.requestFullResolutionOutput()).

This example requires the DepthAI v3 API, see [installation instructions](https://docs.luxonis.com/software-v3/depthai.md).

## Pipeline

### examples/camera_all.pipeline.json

```json
{"pipeline": {"connections": [{"node1Id": 2, "node1Output": "0", "node1OutputGroup": "dynamicOutputs", "node2Id": 7, "node2Input": "in", "node2InputGroup": ""}, {"node1Id": 1, "node1Output": "0", "node1OutputGroup": "dynamicOutputs", "node2Id": 5, "node2Input": "in", "node2InputGroup": ""}, {"node1Id": 0, "node1Output": "0", "node1OutputGroup": "dynamicOutputs", "node2Id": 3, "node2Input": "in", "node2InputGroup": ""}], "globalProperties": {"calibData": null, "cameraTuningBlobSize": null, "cameraTuningBlobUri": "", "leonCssFrequencyHz": 700000000.0, "leonMssFrequencyHz": 700000000.0, "pipelineName": null, "pipelineVersion": null, "sippBufferSize": 18432, "sippDmaBufferSize": 16384, "xlinkChunkSize": -1}, "nodes": [[7, {"alias": "", "id": 7, "ioInfo": [[["", "in"], {"blocking": true, "group": "", "id": 14, "name": "in", "queueSize": 3, "type": 3, "waitForMessage": false}]], "logLevel": 3, "name": "XLinkOut", "parentId": -1, "properties": {"maxFpsLimit": -1.0, "metadataOnly": false, "streamName": "__x_2_0"}}], [5, {"alias": "", "id": 5, "ioInfo": [[["", "in"], {"blocking": true, "group": "", "id": 13, "name": "in", "queueSize": 3, "type": 3, "waitForMessage": false}]], "logLevel": 3, "name": "XLinkOut", "parentId": -1, "properties": {"maxFpsLimit": -1.0, "metadataOnly": false, "streamName": "__x_1_0"}}], [3, {"alias": "", "id": 3, "ioInfo": [[["", "in"], {"blocking": true, "group": "", "id": 12, "name": "in", "queueSize": 3, "type": 3, "waitForMessage": false}]], "logLevel": 3, "name": "XLinkOut", "parentId": -1, "properties": {"maxFpsLimit": -1.0, "metadataOnly": false, "streamName": "__x_0_0"}}], [2, {"alias": "", "id": 2, "ioInfo": [[["dynamicOutputs", "0"], {"blocking": false, "group": "dynamicOutputs", "id": 11, "name": "0", "queueSize": 8, "type": 0, "waitForMessage": false}], [["", "raw"], {"blocking": false, "group": "", "id": 10, "name": "raw", "queueSize": 8, "type": 0, "waitForMessage": false}], [["", "mockIsp"], {"blocking": true, "group": "", "id": 9, "name": "mockIsp", "queueSize": 8, "type": 3, "waitForMessage": false}], [["", "inputControl"], {"blocking": true, "group": "", "id": 8, "name": "inputControl", "queueSize": 3, "type": 3, "waitForMessage": false}]], "logLevel": 3, "name": "Camera", "parentId": -1, "properties": {"boardSocket": 2, "cameraName": "", "fps": -1.0, "imageOrientation": -1, "initialControl": {"aeLockMode": false, "aeMaxExposureTimeUs": 1952543854, "aeRegion": {"height": 26798, "priority": 1967223649, "width": 49779, "x": 28518, "y": 30051}, "afRegion": {"height": 18803, "priority": 1755759171, "width": 30051, "x": 28532, "y": 28518}, "antiBandingMode": 103, "autoFocusMode": 3, "awbLockMode": false, "awbMode": 101, "brightness": -1, "captureIntent": 104, "chromaDenoise": 115, "cmdMask": 0, "contrast": -86, "controlMode": 116, "effectMode": 205, "enableHdr": false, "expCompensation": 110, "expManual": {"exposureTimeUs": 3892825448, "frameDurationUs": 1869903169, "sensitivityIso": 1935763628}, "frameSyncMode": 11, "lensPosAutoInfinity": 119, "lensPosAutoMacro": 105, "lensPosition": 0, "lensPositionRaw": 0.0, "lowPowerNumFramesBurst": 97, "lowPowerNumFramesDiscard": 109, "lumaDenoise": 110, "miscControls": [], "saturation": 115, "sceneMode": 105, "sharpness": 101, "strobeConfig": {"activeLevel": 164, "enable": 224, "gpioNumber": 110}, "strobeTimings": {"durationUs": 1701409391, "exposureBeginOffsetUs": 1868801381, "exposureEndOffsetUs": -1418563732}, "wbColorTemp": 20082}, "isp3aFps": 0, "mockIspHeight": -1, "mockIspWidth": -1, "numFramesPoolIsp": 3, "numFramesPoolPreview": 4, "numFramesPoolRaw": 3, "numFramesPoolStill": 4, "numFramesPoolVideo": 4, "outputRequests": [{"enableUndistortion": null, "fps": {"value": null}, "resizeMode": 0, "size": {"value": {"index": 0, "value": [1280, 800]}}, "type": null}], "resolutionHeight": -1, "resolutionWidth": -1}}], [1, {"alias": "", "id": 1, "ioInfo": [[["dynamicOutputs", "0"], {"blocking": false, "group": "dynamicOutputs", "id": 7, "name": "0", "queueSize": 8, "type": 0, "waitForMessage": false}], [["", "raw"], {"blocking": false, "group": "", "id": 6, "name": "raw", "queueSize": 8, "type": 0, "waitForMessage": false}], [["", "mockIsp"], {"blocking": true, "group": "", "id": 5, "name": "mockIsp", "queueSize": 8, "type": 3, "waitForMessage": false}], [["", "inputControl"], {"blocking": true, "group": "", "id": 4, "name": "inputControl", "queueSize": 3, "type": 3, "waitForMessage": false}]], "logLevel": 3, "name": "Camera", "parentId": -1, "properties": {"boardSocket": 1, "cameraName": "", "fps": -1.0, "imageOrientation": -1, "initialControl": {"aeLockMode": false, "aeMaxExposureTimeUs": 0, "aeRegion": {"height": 0, "priority": 1206227072, "width": 23073, "x": 36848, "y": 18405}, "afRegion": {"height": 0, "priority": 0, "width": 6, "x": 23073, "y": 0}, "antiBandingMode": 110, "autoFocusMode": 3, "awbLockMode": false, "awbMode": 109, "brightness": 0, "captureIntent": 70, "chromaDenoise": 33, "cmdMask": 0, "contrast": 64, "controlMode": 112, "effectMode": 115, "enableHdr": false, "expCompensation": 0, "expManual": {"exposureTimeUs": 29650, "frameDurationUs": 23073, "sensitivityIso": 1206226576}, "frameSyncMode": 0, "lensPosAutoInfinity": 32, "lensPosAutoMacro": 59, "lensPosition": 0, "lensPositionRaw": 0.0, "lowPowerNumFramesBurst": 193, "lowPowerNumFramesDiscard": 0, "lumaDenoise": 71, "miscControls": [], "saturation": -52, "sceneMode": 105, "sharpness": 230, "strobeConfig": {"activeLevel": 101, "enable": 122, "gpioNumber": 100}, "strobeTimings": {"durationUs": 0, "exposureBeginOffsetUs": 1684236333, "exposureEndOffsetUs": 0}, "wbColorTemp": 0}, "isp3aFps": 0, "mockIspHeight": -1, "mockIspWidth": -1, "numFramesPoolIsp": 3, "numFramesPoolPreview": 4, "numFramesPoolRaw": 3, "numFramesPoolStill": 4, "numFramesPoolVideo": 4, "outputRequests": [{"enableUndistortion": null, "fps": {"value": null}, "resizeMode": 0, "size": {"value": {"index": 0, "value": [1280, 800]}}, "type": null}], "resolutionHeight": -1, "resolutionWidth": -1}}], [0, {"alias": "", "id": 0, "ioInfo": [[["dynamicOutputs", "0"], {"blocking": false, "group": "dynamicOutputs", "id": 3, "name": "0", "queueSize": 8, "type": 0, "waitForMessage": false}], [["", "raw"], {"blocking": false, "group": "", "id": 2, "name": "raw", "queueSize": 8, "type": 0, "waitForMessage": false}], [["", "mockIsp"], {"blocking": true, "group": "", "id": 1, "name": "mockIsp", "queueSize": 8, "type": 3, "waitForMessage": false}], [["", "inputControl"], {"blocking": true, "group": "", "id": 0, "name": "inputControl", "queueSize": 3, "type": 3, "waitForMessage": false}]], "logLevel": 3, "name": "Camera", "parentId": -1, "properties": {"boardSocket": 0, "cameraName": "", "fps": -1.0, "imageOrientation": -1, "initialControl": {"aeLockMode": false, "aeMaxExposureTimeUs": 100663297, "aeRegion": {"height": 0, "priority": 1206299200, "width": 0, "x": 4163, "y": 1}, "afRegion": {"height": 0, "priority": 0, "width": 0, "x": 23073, "y": 0}, "antiBandingMode": 230, "autoFocusMode": 3, "awbLockMode": false, "awbMode": 136, "brightness": -86, "captureIntent": 71, "chromaDenoise": 0, "cmdMask": 0, "contrast": 43, "controlMode": 33, "effectMode": 90, "enableHdr": false, "expCompensation": -41, "expManual": {"exposureTimeUs": 23073, "frameDurationUs": 23073, "sensitivityIso": 1206299308}, "frameSyncMode": 0, "lensPosAutoInfinity": 192, "lensPosAutoMacro": 170, "lensPosition": 0, "lensPositionRaw": 0.0, "lowPowerNumFramesBurst": 0, "lowPowerNumFramesDiscard": 0, "lumaDenoise": 0, "miscControls": [], "saturation": 25, "sceneMode": 170, "sharpness": 0, "strobeConfig": {"activeLevel": 232, "enable": 0, "gpioNumber": -80}, "strobeTimings": {"durationUs": 4, "exposureBeginOffsetUs": 23073, "exposureEndOffsetUs": 17}, "wbColorTemp": 0}, "isp3aFps": 0, "mockIspHeight": -1, "mockIspWidth": -1, "numFramesPoolIsp": 3, "numFramesPoolPreview": 4, "numFramesPoolRaw": 3, "numFramesPoolStill": 4, "numFramesPoolVideo": 4, "outputRequests": [{"enableUndistortion": null, "fps": {"value": null}, "resizeMode": 0, "size": {"value": {"index": 0, "value": [4056, 3040]}}, "type": null}], "resolutionHeight": -1, "resolutionWidth": -1}}]]}}
```

## Source code

#### Python

```python
#!/usr/bin/env python3

import cv2
import depthai as dai

# Create pipeline
device = dai.Device()
with dai.Pipeline(device) as pipeline:
    outputQueues = {}
    sockets = device.getConnectedCameras()
    for socket in sockets:
        cam = pipeline.create(dai.node.Camera).build(socket)
        outputQueues[str(socket)] = cam.requestFullResolutionOutput().createOutputQueue()

    pipeline.start()
    while pipeline.isRunning():
        for name in outputQueues.keys():
            queue = outputQueues[name]
            videoIn = queue.get()
            assert isinstance(videoIn, dai.ImgFrame)
            # Visualizing the frame on slower hosts might have overhead
            cv2.imshow(name, videoIn.getCvFrame())

        if cv2.waitKey(1) == ord("q"):
            break
```

#### C++

```cpp
#include <atomic>
#include <csignal>
#include <iostream>
#include <map>
#include <memory>
#include <opencv2/opencv.hpp>
#include <string>

#include "depthai/depthai.hpp"

std::atomic<bool> quitEvent(false);

void signalHandler(int) {
    quitEvent = true;
}

int main() {
    signal(SIGTERM, signalHandler);
    signal(SIGINT, signalHandler);

    // Create device
    std::shared_ptr<dai::Device> device = std::make_shared<dai::Device>();

    // Create pipeline
    dai::Pipeline pipeline(device);

    // Map to store output queues
    std::map<std::string, std::shared_ptr<dai::MessageQueue>> outputQueues;

    // Get connected cameras
    auto sockets = device->getConnectedCameras();
    for(const auto& socket : sockets) {
        auto cam = pipeline.create<dai::node::Camera>();
        cam->build(socket);
        auto output = cam->requestFullResolutionOutput();
        outputQueues[dai::toString(socket)] = output->createOutputQueue();
    }

    pipeline.start();
    while(pipeline.isRunning() && !quitEvent) {
        for(const auto& [name, queue] : outputQueues) {
            auto videoIn = queue->get<dai::ImgFrame>();
            if(videoIn != nullptr) {
                // Visualizing the frame on slower hosts might have overhead
                cv::imshow(name, videoIn->getCvFrame());
            }
        }

        if(cv::waitKey(1) == 'q') {
            break;
        }
    }

    pipeline.stop();
    pipeline.wait();

    return 0;
}
```

### Need assistance?

Head over to [Discussion Forum](https://discuss.luxonis.com/) for technical support or any other questions you might have.
