How to place it
Python
C++
Python
Python
1with dai.Pipeline() as pipeline:
2 manip = pipeline.create(dai.node.ImageManip)Inputs and Outputs
Usage
Python
C++
Python
Python
1pipeline = dai.Pipeline()
2manip = pipeline.create(dai.node.ImageManip)
3
4manip.initialConfig.setResize(300, 300, dai.ImageManipConfig.ResizeMode.STRETCH)
5manip.initialConfig.setFrameType(dai.ImgFrame.Type.BGR888p)Image formats supported
- Input formats supported: RGB/BGR, planar/interleaved, YUV/NV12, RAW8 and GRAY8
- Convert format to any other format mentioned above
- RAW16 (uint16,
depthoutput) supported, but without color conversion capability
Operations order
Python
1manip = pipeline.create(dai.node.ImageManip)
2manip.initialConfig.addCrop(50, 100, 500, 500)
3manip.initialConfig.addFlipVertical()Resizing and Aspect Ratio Handling
ImageManip, use:Python
1manip = pipeline.create(dai.node.ImageManip)
2manip.initialConfig.setOutputSize(width, height, dai.ImageManipConfig.ResizeMode)| Mode | Preserves AR | Full FOV | Pros | Cons |
|---|---|---|---|---|
CENTER_CROP | Yes | No | Best for NN accuracy; preserves AR | Crops image; reduces field of view |
LETTERBOX | Yes | Yes | Preserves AR and full FOV | Adds padding; smaller image area for NN; may reduce NN accuracy |
STRETCH | No | Yes | Preserves full field of view | Aspect ratio not preserved; may reduce NN accuracy |
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
- ImageManip Multiple operations - Uses multiple operations one after another (order matters)
- ImageManip All operations - Showcases all available operations
- ImageManip resize - Resizes the input image to 300x300 frame
- ImageManip remap - Use ImageManip to modify a frame and remap a rectangle accordingly.
Reference
class
dai::node::ImageManip
variable
std::shared_ptr< ImageManipConfig > initialConfig
Initial config to use when manipulating frames
variable
Input inputConfig
variable
Input inputImage
Input image to be modified
variable
function
ImageManip()function
ImageManip(std::unique_ptr< Properties > props)inline function
std::shared_ptr< ImageManip > build()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
ImageManip & setRunOnHost(bool runOnHost)Specify whether to run on host or device
Parameters
- runOnHost: Run node on host
function
ImageManip & setBackend(Backend backend)Set CPU as backend preference
Parameters
- backend: Backend preference
function
ImageManip & setPerformanceMode(PerformanceMode performanceMode)Set performance mode
Parameters
- performanceMode: Performance mode
function
bool runOnHost()Check if the node is set to run on host
function
void run()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)enum
ImageManipProperties::Backend Backend
enum
ImageManipProperties::PerformanceMode PerformanceMode
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.