DepthAI Tutorials
DepthAI API References

ON THIS PAGE

  • Undistort camera stream
  • Demo
  • Setup
  • Source code
  • Pipeline

Undistort camera stream

This example shows how you can use Camera node to undistort wide FOV camera stream. Camera node will automatically undistort still, video and preview streams, while isp stream will be left as is.

Demo

Setup

Please run the install script to download all required dependencies. Please note that this script must be ran from git context, so you have to download the depthai-python repository first and then run the script
Command Line
1git clone https://github.com/luxonis/depthai-python.git
2cd depthai-python/examples
3python3 install_requirements.py
For additional information, please follow the installation guide.

Source code

Python
C++

Python

Python
GitHub
1#!/usr/bin/env python3
2
3import depthai as dai
4import cv2
5
6pipeline = dai.Pipeline()
7
8# Define sources and outputs
9camRgb: dai.node.Camera = pipeline.create(dai.node.Camera)
10
11#Properties
12camRgb.setBoardSocket(dai.CameraBoardSocket.CAM_A)
13camRgb.setSize((1280, 800))
14
15# Linking
16videoOut = pipeline.create(dai.node.XLinkOut)
17videoOut.setStreamName("video")
18camRgb.video.link(videoOut.input)
19
20ispOut = pipeline.create(dai.node.XLinkOut)
21ispOut.setStreamName("isp")
22camRgb.isp.link(ispOut.input)
23
24with dai.Device(pipeline) as device:
25    video = device.getOutputQueue(name="video", maxSize=1, blocking=False)
26    isp = device.getOutputQueue(name="isp", maxSize=1, blocking=False)
27
28    while True:
29        if video.has():
30            cv2.imshow("video", video.get().getCvFrame())
31        if isp.has():
32            cv2.imshow("isp", isp.get().getCvFrame())
33        if cv2.waitKey(1) == ord('q'):
34            break

Pipeline

Need assistance?

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