DepthAI v2 has been superseded by DepthAI v3. You are viewing legacy documentation.

本页目录

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

Warp

Warp 节点用于图像扭曲和去扭曲,可用于矫正宽视场相机拍摄的图像。该节点也可用于对图像应用透视变换。ImageManip 节点(setWarpMesh() 函数)相比:Warp 节点 使用底层的扭曲硬件模块(额外资源请参阅 此处文档),无需额外资源(SHAVE/CMX 核心)。硬件限制:宽度必须能被 16 整除。ImageManip 节点 结合了扭曲硬件模块的能力和 CMX 内存的效率,以实现更高的吞吐量(例如 4k@30 fps)。硬件模块的调度由 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.

需要帮助?

请前往 OAKChina 官网 获取技术支持或解答您的任何疑问。