ImageManip node can be used to crop, rotate rectangle area or perform various image transforms: rotate, mirror, flip, perspective transform.

For downscaling, ImageManip uses the bilinear/bicubic interpolation.

How to place it

pipeline = dai.Pipeline()
manip = pipeline.create(dai.node.ImageManip)
dai::Pipeline pipeline;
auto manip = pipeline.create<dai::node::ImageManip>();

Inputs and Outputs

inputImage     │                   │
──────────────►│                   │
               │                   │        out
               │    ImageManip     ├───────────►
inputConfig    │                   │
──────────────►│                   │
               │                   │

Message types


pipeline = dai.Pipeline()
manip = pipeline.create(dai.node.ImageManip)

manip.initialConfig.setResize(300, 300)
dai::Pipeline pipeline;
auto manip = pipeline.create<dai::node::ImageManip>();

manip->initialConfig.setResize(300, 300);

Image formats supported

ImageManip node supports the following image formats (more info in PR here):

  • Input formats supported: RGB/BGR, planar/interleaved, YUV/NV12, RAW8 and GRAY8

  • Convert format to any other format mentioned above

  • RAW16 (uint16, depth output) supported, but without color conversion capability

Note that planar formats are faster to process, so interleaved images should be avoided (eg. NV12 input).


Besides limitations mentioned above (unsupported frame formats), there are other limitations:

  • Due to HW warp constraint, rotating/warping can be done only on frames whose width values are multiples of 16

  • Maximum output width of a frame is 4056 pixels

Examples of functionality


class depthai.node.ImageManip
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

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]
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

getWaitForConfigInput(self: depthai.node.ImageManip)bool
setCenterCrop(self: depthai.node.ImageManip, arg0: float, arg1: float)None
setCropRect(self: depthai.node.ImageManip, arg0: float, arg1: float, arg2: float, arg3: float)None
setFrameType(self: depthai.node.ImageManip, arg0: depthai.RawImgFrame.Type)None
setHorizontalFlip(self: depthai.node.ImageManip, arg0: bool)None
setKeepAspectRatio(self: depthai.node.ImageManip, arg0: bool)None
setMaxOutputFrameSize(self: depthai.node.ImageManip, arg0: int)None
setNumFramesPool(self: depthai.node.ImageManip, arg0: int)None
setResize(self: depthai.node.ImageManip, arg0: int, arg1: int)None
setResizeThumbnail(self: depthai.node.ImageManip, arg0: int, arg1: int, arg2: int, arg3: int, arg4: int)None
setWaitForConfigInput(self: depthai.node.ImageManip, wait: bool)None
setWarpMesh(*args, **kwargs)

Overloaded function.

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

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

class dai::node::ImageManip : public dai::NodeCRTP<Node, ImageManip, ImageManipProperties>

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

Public Functions

ImageManip(const std::shared_ptr<PipelineImpl> &par, int64_t nodeId)
ImageManip(const std::shared_ptr<PipelineImpl> &par, int64_t nodeId, std::unique_ptr<Properties> props)
void setCropRect(float xmin, float ymin, float xmax, float ymax)
void setCenterCrop(float ratio, float whRatio = 1.0f)
void setResize(int w, int h)
void setResizeThumbnail(int w, int h, int bgRed = 0, int bgGreen = 0, int bgBlue = 0)
void setFrameType(ImgFrame::Type name)
void setHorizontalFlip(bool flip)
void setKeepAspectRatio(bool keep)
void setWaitForConfigInput(bool wait)

Specify whether or not wait until configuration message arrives to inputConfig Input.

  • wait: True to wait for configuration message, false otherwise.

bool getWaitForConfigInput() const




True if wait for inputConfig message, false otherwise

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 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)

Public Members

ImageManipConfig initialConfig

Initial config to use when manipulating frames

Input inputConfig = {*this, "inputConfig", Input::Type::SReceiver, true, 8, {{DatatypeEnum::ImageManipConfig, true}}}

Input ImageManipConfig message with ability to modify parameters in runtime Default queue is blocking with size 8

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 modified image.

Public Static Attributes

static constexpr const char *NAME = "ImageManip"

Private Functions

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

Private Members

std::shared_ptr<RawImageManipConfig> rawConfig

Got questions?

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