# ImageManip

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

#### Python

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

#### C++

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

## Inputs and Outputs

## Usage

#### Python

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

manip.initialConfig.setResize(300, 300)
manip.initialConfig.setFrameType(dai.ImgFrame.Type.BGR888p)
```

#### C++

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

manip->initialConfig.setResize(300, 300);
manip->initialConfig.setFrameType(dai::ImgFrame::Type::BGR888p);
```

## Image formats supported

ImageManip node supports the following image formats (more info [in PR here](https://github.com/luxonis/depthai-core/pull/444)):

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

## Limitations

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

 * [Mono & MobilenetSSD](https://docs.luxonis.com/software/depthai/examples/mono_depth_mobilenetssd.md)
 * [RGB Encoding & Mono & MobilenetSSD](https://docs.luxonis.com/software/depthai/examples/rgb_encoding_mono_mobilenet.md)
 * [RGB Camera Control](https://docs.luxonis.com/software/depthai/examples/rgb_camera_control.md)
 * [ImageManip tiling](https://docs.luxonis.com/software/depthai/examples/image_manip_tiling.md) - Using ImageManip for frame
   tiling
 * [ImageManip rotate](https://docs.luxonis.com/software/depthai/examples/image_manip_rotate.md) - Using ImageManip to rotate
   color/mono frames

## Reference

### depthai.node.ImageManip(depthai.Node)

Kind: Class

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

#### getWaitForConfigInput(self) -> bool: bool

Kind: Method

See also:
setWaitForConfigInput

Returns:
True if wait for inputConfig message, false otherwise

#### setCenterCrop(self, arg0: typing.SupportsFloat, arg1: typing.SupportsFloat)

Kind: Method

#### setCropRect(self, arg0: typing.SupportsFloat, arg1: typing.SupportsFloat, arg2: typing.SupportsFloat, arg3:
typing.SupportsFloat)

Kind: Method

#### setFrameType(self, arg0: depthai.RawImgFrame.Type)

Kind: Method

#### setHorizontalFlip(self, arg0: bool)

Kind: Method

#### setKeepAspectRatio(self, arg0: bool)

Kind: Method

#### setMaxOutputFrameSize(self, arg0: typing.SupportsInt)

Kind: Method

Specify maximum size of output image.

Parameter ``maxFrameSize``:
Maximum frame size in bytes

#### setNumFramesPool(self, arg0: typing.SupportsInt)

Kind: Method

Specify number of frames in pool.

Parameter ``numFramesPool``:
How many frames should the pool have

#### setResize(self, arg0: typing.SupportsInt, arg1: typing.SupportsInt)

Kind: Method

#### setResizeThumbnail(self, arg0: typing.SupportsInt, arg1: typing.SupportsInt, arg2: typing.SupportsInt, arg3:
typing.SupportsInt, arg4: typing.SupportsInt)

Kind: Method

#### setWaitForConfigInput(self, wait: bool)

Kind: Method

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

Parameter ``wait``:
True to wait for configuration message, false otherwise.

#### setWarpMesh()

Kind: Method

#### initialConfig

Kind: Property

Initial config to use when manipulating frames

#### inputConfig

Kind: Property

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

#### inputImage

Kind: Property

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

#### out

Kind: Property

Outputs ImgFrame message that carries modified image.

### Need assistance?

Head over to [Discussion Forum](https://discuss.luxonis.com/) for technical support or any other questions you might have.
