# 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

## 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.
