Undistort camera stream
This example shows how you can use Camera node to undistort wide FOV camera stream. Camera node will automatically undistortstill
, 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 scriptCommand Line
1git clone https://github.com/luxonis/depthai-python.git
2cd depthai-python/examples
3python3 install_requirements.py
Source code
Python
C++
Python
PythonGitHub
1import depthai as dai
2import cv2
3
4pipeline = dai.Pipeline()
5
6# Define sources and outputs
7camRgb: dai.node.Camera = pipeline.create(dai.node.Camera)
8
9#Properties
10camRgb.setBoardSocket(dai.CameraBoardSocket.CAM_A)
11camRgb.setSize((1280, 800))
12
13# Linking
14videoOut = pipeline.create(dai.node.XLinkOut)
15videoOut.setStreamName("video")
16camRgb.video.link(videoOut.input)
17
18ispOut = pipeline.create(dai.node.XLinkOut)
19ispOut.setStreamName("isp")
20camRgb.isp.link(ispOut.input)
21
22with dai.Device(pipeline) as device:
23 video = device.getOutputQueue(name="video", maxSize=1, blocking=False)
24 isp = device.getOutputQueue(name="isp", maxSize=1, blocking=False)
25
26 while True:
27 if video.has():
28 cv2.imshow("video", video.get().getCvFrame())
29 if isp.has():
30 cv2.imshow("isp", isp.get().getCvFrame())
31 if cv2.waitKey(1) == ord('q'):
32 break
Pipeline
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.