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 <iostream>
2#include <memory>
3#include <opencv2/opencv.hpp>
4
5#include "depthai/depthai.hpp"
6
7int main() {
8    // Create device
9    std::shared_ptr<dai::Device> device = std::make_shared<dai::Device>();
10
11    // Create pipeline
12    dai::Pipeline pipeline(device);
13
14    // Create nodes
15    auto cam = pipeline.create<dai::node::Camera>()->build();
16    // In some cases (IMX586), this requires an 8k screen to be able to see the full resolution at once
17    auto videoQueue = cam->requestFullResolutionOutput()->createOutputQueue();
18
19    // Start pipeline
20    pipeline.start();
21
22    while(true) {
23        auto videoIn = videoQueue->get<dai::ImgFrame>();
24        if(videoIn == nullptr) continue;
25
26        cv::imshow("video", videoIn->getCvFrame());
27
28        if(cv::waitKey(1) == 'q') {
29            break;
30        }
31    }
32
33    return 0;
34}

Need assistance?

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