Warp node is used for image warping and dewarping, which can be used to undistort images from wide FOV cameras. The node can also be used to apply a perspective transform to the image.

Compared to ImageManip node (the setWarpMesh() function):

Warp node uses underlyting warp HW block (additional docs here), with no extra resources (SHAVE/cmx cores). HW limitation: width must be divisible by 16.

ImageManip node combines the power of warp HW block together the efficiency of CMX memory to achieve higher throughput (e.g. 4k@30 fps). Scheduling of the HW block is done by SHAVE cores which also do color space conversion, type conversion (YUV420 to NV12), etc. The downside of using ImageManip node is extra RAM and SHAVE usage.

How to place it

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

Inputs and Outputs

inputImage │            │    out
──────────►│    Warp    ├──────►
           │            │

Message types


pipeline = dai.Pipeline()

warp = pipeline.create(dai.node.Warp)
# Create a custom warp mesh
p1 = dai.Point2f(20, 20)
p2 = dai.Point2f(460, 20)
p3 = dai.Point2f(20, 460)
p4 = dai.Point2f(460, 460)
warp.setWarpMesh([p1,p2,p3,p4], 2, 2)
warp.setMaxOutputFrameSize(512 * 512 * 3)
# Warp engines to be used (0,1,2)
# Warp interpolation mode, choose between BILINEAR, BICUBIC, BYPASS
dai::Pipeline pipeline;

auto warp = pipeline.create<dai::node::Warp>();
// Create a custom warp mesh
dai::Point2f p1(20, 20);
dai::Point2f p2(460, 20);
dai::Point2f p3(20, 460);
dai::Point2f p4(460, 460);
warp->setWarpMesh({p1,p2,p3,p4}, 2, 2);
warp->setOutputSize({512, 512});
warp->setMaxOutputFrameSize(512 * 512 * 3);
// Warp engines to be used (0,1,2)
// Warp interpolation mode, choose between BILINEAR, BICUBIC, BYPASS

Examples of functionality


class depthai.node.Warp
class Id

Node identificator. Unique for every node on a single Pipeline

getAssetManager(*args, **kwargs)

Overloaded function.

  1. getAssetManager(self: depthai.Node) -> depthai.AssetManager

  2. getAssetManager(self: depthai.Node) -> depthai.AssetManager

getHwIds(self: depthai.node.Warp) → List[int]
getInputRefs(*args, **kwargs)

Overloaded function.

  1. getInputRefs(self: depthai.Node) -> List[depthai.Node.Input]

  2. getInputRefs(self: depthai.Node) -> List[depthai.Node.Input]

getInputs(self: depthai.Node) → List[depthai.Node.Input]
getInterpolation(self: depthai.node.Warp)depthai.Interpolation
getName(self: depthai.Node)str
getOutputRefs(*args, **kwargs)

Overloaded function.

  1. getOutputRefs(self: depthai.Node) -> List[depthai.Node.Output]

  2. getOutputRefs(self: depthai.Node) -> List[depthai.Node.Output]

getOutputs(self: depthai.Node) → List[depthai.Node.Output]
getParentPipeline(*args, **kwargs)

Overloaded function.

  1. getParentPipeline(self: depthai.Node) -> depthai.Pipeline

  2. getParentPipeline(self: depthai.Node) -> depthai.Pipeline

setHwIds(self: depthai.node.Warp, arg0: List[int])None
setInterpolation(self: depthai.node.Warp, arg0: depthai.Interpolation)None
setMaxOutputFrameSize(self: depthai.node.Warp, arg0: int)None
setNumFramesPool(self: depthai.node.Warp, arg0: int)None
setOutputSize(*args, **kwargs)

Overloaded function.

  1. setOutputSize(self: depthai.node.Warp, arg0: int, arg1: int) -> None

  2. setOutputSize(self: depthai.node.Warp, arg0: Tuple[int, int]) -> None

setWarpMesh(*args, **kwargs)

Overloaded function.

  1. setWarpMesh(self: depthai.node.Warp, arg0: List[depthai.Point2f], arg1: int, arg2: int) -> None

  2. setWarpMesh(self: depthai.node.Warp, arg0: List[Tuple[float, float]], arg1: int, arg2: int) -> None

class dai::node::Warp : public dai::NodeCRTP<Node, Warp, WarpProperties>

Warp node. Capability to crop, resize, warp, … incoming image frames.

Public Functions

Warp(const std::shared_ptr<PipelineImpl> &par, int64_t nodeId)
Warp(const std::shared_ptr<PipelineImpl> &par, int64_t nodeId, std::unique_ptr<Properties> props)
void setOutputSize(std::tuple<int, int> size)

Sets output frame size in pixels

  • size: width and height in pixels

void setOutputSize(int width, int height)
void setWarpMesh(const std::vector<Point2f> &meshData, int width, int height)

Set a custom warp mesh

  • meshData: 2D plane of mesh points, starting from top left to bottom right

  • width: Width of mesh

  • height: Height of mesh

void setWarpMesh(const std::vector<std::pair<float, float>> &meshData, int width, int height)
void setNumFramesPool(int numFramesPool)

Specify number of frames in pool.

  • numFramesPool: How many frames should the pool have

void setMaxOutputFrameSize(int maxFrameSize)

Specify maximum size of output image.

  • maxFrameSize: Maximum frame size in bytes

void setHwIds(std::vector<int> ids)

Specify which hardware warp engines to use

  • ids: Which warp engines to use (0, 1, 2)

std::vector<int> getHwIds() const

Retrieve which hardware warp engines to use.

void setInterpolation(dai::Interpolation interpolation)

Specify which interpolation method to use

  • interpolation: type of interpolation

dai::Interpolation getInterpolation() const

Retrieve which interpolation method to use.

Public Members

Input inputImage = {*this, "inputImage", Input::Type::SReceiver, true, 8, true, {{DatatypeEnum::ImgFrame, true}}}

Input image to be modified Default queue is blocking with size 8

Output out = {*this, "out", Output::Type::MSender, {{DatatypeEnum::ImgFrame, true}}}

Outputs ImgFrame message that carries warped image.

Public Static Attributes

static constexpr const char *NAME = "Warp"

Private Functions

void setWarpMesh(const float *meshData, int numMeshPoints, int width, int height)

Got questions?

Head over to Discussion Forum for technical support or any other questions you might have.