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

本页目录

  • 如何放置
  • 输入和输出
  • 用法
  • 功能示例
  • 参考

Warp

Warp 节点用于图像的翘曲和去翘曲,可用于校正宽视场摄像头的图像畸变。 该节点还可以用于对图像应用透视变换。ImageManip 节点(setWarpMesh() 函数)相比:Warp 节点 使用底层的翘曲硬件块(更多信息请参阅 文档), 无需额外资源(SHAVE/cmx 核心)。硬件限制:宽度必须是 16 的倍数。ImageManip 节点 结合了翘曲硬件块的强大功能和 CMX 内存的效率,以实现更高的 吞吐量(例如 4k@30 fps)。硬件块的调度由 SHAVE 核心完成,SHAVE 核心还负责颜色空间转换、类型转换(YUV420 到 NV12)等。 使用 ImageManip 节点的缺点是额外的 RAM 和 SHAVE 资源消耗。

如何放置

Python

Python
1pipeline = dai.Pipeline()
2warp = pipeline.create(dai.node.Warp)

C++

C++
1dai::Pipeline pipeline;
2auto warp = pipeline.create<dai::node::Warp>();

输入和输出

用法

Python

Python
1pipeline = dai.Pipeline()
2
3warp = pipeline.create(dai.node.Warp)
4# 创建自定义翘曲网格
5p1 = dai.Point2f(20, 20)
6p2 = dai.Point2f(460, 20)
7p3 = dai.Point2f(20, 460)
8p4 = dai.Point2f(460, 460)
9warp.setWarpMesh([p1,p2,p3,p4], 2, 2)
10warp.setOutputSize((512,512))
11warp.setMaxOutputFrameSize(512 * 512 * 3)
12# 要使用的翘曲引擎 (0,1,2)
13warp.setHwIds([1])
14# 翘曲插值模式,可在 BILINEAR, BICUBIC, BYPASS 中选择
15warp.setInterpolation(dai.Interpolation.NEAREST_NEIGHBOR)

C++

C++
1dai::Pipeline pipeline;
2
3auto warp = pipeline.create<dai::node::Warp>();
4// 创建自定义翘曲网格
5dai::Point2f p1(20, 20);
6dai::Point2f p2(460, 20);
7dai::Point2f p3(20, 460);
8dai::Point2f p4(460, 460);
9warp->setWarpMesh({p1,p2,p3,p4}, 2, 2);
10warp->setOutputSize({512, 512});
11warp->setMaxOutputFrameSize(512 * 512 * 3);
12// 要使用的翘曲引擎 (0,1,2)
13warp->setHwIds({1});
14// 翘曲插值模式,可在 BILINEAR, BICUBIC, BYPASS 中选择
15warp->setInterpolation(dai::node::Warp::Properties::Interpolation::BYPASS);

功能示例

参考

class

depthai.node.Warp(depthai.Node)

method
getHwIds(self) -> list[int]: list[int]
Retrieve which hardware warp engines to use
method
method
setHwIds(self, arg0: collections.abc.Sequence [ typing.SupportsInt ])
Specify which hardware warp engines to use  Parameter ``ids``:     Which warp engines to use (0, 1, 2)
method
setInterpolation(self, arg0: depthai.Interpolation)
Specify which interpolation method to use  Parameter ``interpolation``:     type of interpolation
method
setMaxOutputFrameSize(self, arg0: typing.SupportsInt)
Specify maximum size of output image.  Parameter ``maxFrameSize``:     Maximum frame size in bytes
method
setNumFramesPool(self, arg0: typing.SupportsInt)
Specify number of frames in pool.  Parameter ``numFramesPool``:     How many frames should the pool have
method
method
property
inputImage
Input image to be modified Default queue is blocking with size 8
property
out
Outputs ImgFrame message that carries warped image.

需要帮助?

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