ON THIS PAGE

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

Warp

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
RVC4

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.

How to place it

Python
C++

Python

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

Inputs and Outputs

Usage

Python
C++

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)

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.