DepthAI
Software Stack

ON THIS PAGE

  • Pipeline
  • Source code

Camera video max resolution

Supported on:RVC2RVC4
Display the camera stream at the highest available resolution on the host using OpenCV. This example uses the Camera node with requestFullResolutionOutput(useHighestResolution=True) to request the sensor’s maximum stream.This example requires the DepthAI v3 API, see installation instructions.

Pipeline

Source code

Python

Python
GitHub
1#!/usr/bin/env python3
2
3import cv2
4import depthai as dai
5
6# Create pipeline
7with dai.Pipeline() as pipeline:
8    # Define source and output
9    cam = pipeline.create(dai.node.Camera).build()
10    # In some cases (IMX586), this requires an 8k screen to be able to see the full resolution at once
11    videoQueue = cam.requestFullResolutionOutput(useHighestResolution=True).createOutputQueue()
12
13    # Connect to device and start pipeline
14    pipeline.start()
15    while pipeline.isRunning():
16        videoIn = videoQueue.get()
17        assert isinstance(videoIn, dai.ImgFrame)
18        cv2.imshow("video", videoIn.getCvFrame())
19
20        if cv2.waitKey(1) == ord("q"):
21            break

C++

1#include <atomic>
2#include <csignal>
3#include <iostream>
4#include <memory>
5#include <opencv2/opencv.hpp>
6
7#include "depthai/depthai.hpp"
8
9std::atomic<bool> quitEvent(false);
10
11void signalHandler(int) {
12    quitEvent = true;
13}
14
15int main() {
16    signal(SIGTERM, signalHandler);
17    signal(SIGINT, signalHandler);
18
19    // Create device
20    std::shared_ptr<dai::Device> device = std::make_shared<dai::Device>();
21
22    // Create pipeline
23    dai::Pipeline pipeline(device);
24
25    // Create nodes
26    auto cam = pipeline.create<dai::node::Camera>()->build();
27    // In some cases (IMX586), this requires an 8k screen to be able to see the full resolution at once
28    auto videoQueue = cam->requestFullResolutionOutput()->createOutputQueue();
29
30    // Start pipeline
31    pipeline.start();
32
33    while(pipeline.isRunning() && !quitEvent) {
34        auto videoIn = videoQueue->get<dai::ImgFrame>();
35        if(videoIn == nullptr) continue;
36
37        cv::imshow("video", videoIn->getCvFrame());
38
39        if(cv::waitKey(1) == 'q') {
40            break;
41        }
42    }
43
44    pipeline.stop();
45    pipeline.wait();
46
47    return 0;
48}

Need assistance?

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