ON THIS PAGE

  • How to place it
  • Inputs and Outputs
  • Usage
  • Examples of functionality
  • Reference

Warp

Supported on:RVC2RVC4
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.

RVC2

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.

RVC4

Warp node is also run on Warp engine (HW block on RVC4 chip). Note: at the moment, chroma plane warping is not yet supported on RVC4, so only grayscale images can be warped (correctly). We're working with our silicon vendor to enable this feature.

How to place it

Python

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

C++

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

Inputs and Outputs

Usage

Python

Python
1with dai.Pipeline() as pipeline:
2    warp = pipeline.create(dai.node.Warp)
3    # Create a custom warp mesh
4    p1 = dai.Point2f(20, 20)
5    p2 = dai.Point2f(460, 20)
6    p3 = dai.Point2f(20, 460)
7    p4 = dai.Point2f(460, 460)
8    warp.setWarpMesh([p1,p2,p3,p4], 2, 2)
9    warp.setOutputSize((512,512))
10    warp.setMaxOutputFrameSize(512 * 512 * 3)
11
12    # Warp interpolation mode, choose between BILINEAR, BICUBIC, BYPASS
13    warp.setInterpolation(dai.Interpolation.BILINEAR)

C++

C++
1dai::Pipeline pipeline;
2
3auto warp = pipeline.create<dai::node::Warp>();
4// Create a custom warp mesh
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
13// Warp interpolation mode, choose between BILINEAR, BICUBIC, BYPASS
14warp->setInterpolation(dai::node::Warp::Properties::Interpolation::BILINEAR);

Examples of functionality

Reference

class

dai::node::Warp

#include Warp.hpp
variable
Input inputImage
Input image to be modified Default queue is blocking with size 8
variable
Output out
Outputs ImgFrame message that carries warped image.
function
void setOutputSize(std::tuple< int, int > size)
Sets output frame size in pixels
Parameters
  • size: width and height in pixels
function
void setOutputSize(int width, int height)
function
void setWarpMesh(const std::vector< Point2f > & meshData, int width, int height)
Set a custom warp mesh
Parameters
  • meshData: 2D plane of mesh points, starting from top left to bottom right
  • width: Width of mesh
  • height: Height of mesh
function
void setWarpMesh(const std::vector< std::pair< float, float >> & meshData, int width, int height)
function
void setNumFramesPool(int numFramesPool)
Specify number of frames in pool.
Parameters
  • numFramesPool: How many frames should the pool have
function
void setMaxOutputFrameSize(int maxFrameSize)
Specify maximum size of output image.
Parameters
  • maxFrameSize: Maximum frame size in bytes
function
void setHwIds(std::vector< int > ids)
Specify which hardware warp engines to use
Parameters
  • ids: Which warp engines to use (0, 1, 2)
function
std::vector< int > getHwIds()
function
void setInterpolation(dai::Interpolation interpolation)
Specify which interpolation method to use
Parameters
  • interpolation: type of interpolation
function
dai::Interpolation getInterpolation()
inline function
DeviceNodeCRTP()
inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device)
inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props)
inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props, bool confMode)
inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device, std::unique_ptr< Properties > props, bool confMode)

Need assistance?

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