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
git clone https://github.com/luxonis/depthai-python.git
cd depthai-python/examples
python3 install_requirements.py
For additional information, please follow installation guide
Source code¶
Also available on GitHub
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | import depthai as dai
import cv2
pipeline = dai.Pipeline()
# Define sources and outputs
camRgb: dai.node.Camera = pipeline.create(dai.node.Camera)
#Properties
camRgb.setBoardSocket(dai.CameraBoardSocket.CAM_A)
camRgb.setSize((1280, 800))
# Linking
videoOut = pipeline.create(dai.node.XLinkOut)
videoOut.setStreamName("video")
camRgb.video.link(videoOut.input)
ispOut = pipeline.create(dai.node.XLinkOut)
ispOut.setStreamName("isp")
camRgb.isp.link(ispOut.input)
with dai.Device(pipeline) as device:
video = device.getOutputQueue(name="video", maxSize=1, blocking=False)
isp = device.getOutputQueue(name="isp", maxSize=1, blocking=False)
while True:
if video.has():
cv2.imshow("video", video.get().getCvFrame())
if isp.has():
cv2.imshow("isp", isp.get().getCvFrame())
if cv2.waitKey(1) == ord('q'):
break
|
Work in progress.