# ImageManip

ImageManip 节点可用于裁剪、旋转矩形区域或执行各种图像变换：旋转、镜像、翻转、透视变换。

在缩小时，ImageManip 使用双线性/双三次插值。

## 放置方法

#### Python

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

#### C++

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

## 输入与输出

## 使用方法

#### 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);
```

## 支持的图像格式

ImageManip 节点支持以下图像格式（更多信息请[参阅此处 PR](https://github.com/luxonis/depthai-core/pull/444)）：

 * 支持的输入格式：RGB/BGR、平面/交错、YUV/NV12、RAW8 和 GRAY8
 * 可将格式转换为上述任意其他格式
 * 支持 RAW16（uint16，depth 输出），但无颜色转换能力

请注意，平面格式处理速度更快，因此应避免使用交错图像（例如 NV12 输入）。

## 限制

除了上述限制（不支持的帧格式）之外，还有其他限制：

 * 由于硬件 warp 限制，只能对宽度为 16 倍数的帧进行旋转/warp 操作
 * 帧的最大输出宽度为 4056 像素

## 功能示例

 * [单目 & MobilenetSSD](https://docs.luxonis.com/software/depthai/examples/mono_depth_mobilenetssd.md)
 * [RGB 编码 & 单目 & MobilenetSSD](https://docs.luxonis.com/software/depthai/examples/rgb_encoding_mono_mobilenet.md)
 * [RGB 摄像头控制](https://docs.luxonis.com/software/depthai/examples/rgb_camera_control.md)
 * [ImageManip 平铺](https://docs.luxonis.com/software/depthai/examples/image_manip_tiling.md) - 使用 ImageManip 进行帧平铺
 * [ImageManip 旋转](https://docs.luxonis.com/software/depthai/examples/image_manip_rotate.md) - 使用 ImageManip 旋转彩色/单色帧

## 参考

### 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.

### 需要帮助？

请前往 [OAKChina 官网](https://www.oakchina.cn/) 获取技术支持或解答您的任何疑问。
