DepthAI v2 has been superseded by DepthAI v3. You are viewing legacy documentation.
此页面由 AI 自动翻译。查看英文原版
DepthAI 教程
DepthAI API 参考

本页目录

  • 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

请运行 安装脚本 以下载所有必需的依赖项。请注意,此脚本必须在 git 上下文中运行,因此您必须先下载 depthai-python 存储库,然后运行脚本
Command Line
1git clone https://github.com/luxonis/depthai-python.git
2cd depthai-python/examples
3python3 install_requirements.py
有关更多信息,请遵循 安装指南

Source code

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

C++

WIP

Pipeline

需要帮助?

请前往 Discussion Forum 获取技术支持或提出您可能有的任何其他问题。