ImageManipConfig
This message can is used for cropping, warping, rotating, resizing, etc. an image in runtime. It can be sent from host/Script node to either Camera or ImageManip.This message will reconfigure the whole config of the node, meaning you need to set all settings, not just the setting you want to change.
Reference
class
dai::ImageManipConfig
variable
ImageManipOpsBase< Container > base
variable
ImgFrame::Type outputFrameType
variable
bool reusePreviousImage
variable
bool skipCurrentImage
function
ImageManipConfig()
function
~ImageManipConfig()
function
ImageManipConfig & clearOps()
Removes all operations from the list (does not affect output configuration)
function
ImageManipConfig & addCrop(uint32_t x, uint32_t y, uint32_t w, uint32_t h)
Crops the image to the specified rectangle
Parameters
- x: X coordinate of the top-left corner
- y: Y coordinate of the top-left corner
- w: Width of the rectangle
- h: Height of the rectangle
function
ImageManipConfig & addCrop(dai::Rect rect, bool normalizedCoords)
Crops the image to the specified rectangle
Parameters
- rect: Rect to crop
- normalizedCoords: If true, the coordinates are normalized to range [0, 1] where 1 maps to the width/height of the image
function
ImageManipConfig & addCropRotatedRect(dai::RotatedRect rotatedRect, bool normalizedCoords)
Crops the image to the specified (rotated) rectangle
Parameters
- rect: RotatedRect to crop
- normalizedCoords: If true, the coordinates are normalized to range [0, 1] where 1 maps to the width/height of the image
function
ImageManipConfig & addScale(float scaleX, float scaleY)
Rescales the image using the specified factors
Parameters
- scaleX: Scale factor for the X axis
- scaleY: Scale factor for the Y axis. If not specified, scaleY is set to the same value as scaleX
function
ImageManipConfig & addRotateDeg(float angle)
Rotates the image around its center by the specified angle in degrees
Parameters
- angle: Angle in radians
function
ImageManipConfig & addRotateDeg(float angle, Point2f center)
Rotates the image around the specified point by the specified angle in degrees
Parameters
- angle: Angle in radians
- center: Center of the rotation using normalized coordinates
function
ImageManipConfig & addFlipHorizontal()
Flips the image horizontally
function
ImageManipConfig & addFlipVertical()
Flips the image vertically
function
ImageManipConfig & addTransformAffine(std::array< float, 4 > matrix)
Applies an affine transformation to the image
Parameters
- matrix: an array containing a 2x2 matrix representing the affine transformation
function
ImageManipConfig & addTransformPerspective(std::array< float, 9 > matrix)
Applies a perspective transformation to the image
Parameters
- matrix: an array containing a 3x3 matrix representing the perspective transformation
function
ImageManipConfig & addTransformFourPoints(std::array< dai::Point2f, 4 > src, std::array< dai::Point2f, 4 > dst, bool normalizedCoords)
Applies a perspective transformation to the image
Parameters
- src: Source points
- dst: Destination points
- normalizedCoords: If true, the coordinates are normalized to range [0, 1] where 1 maps to the width/height of the image
function
ImageManipConfig & setOutputSize(uint32_t w, uint32_t h, ResizeMode mode)
Sets the output size of the image
Parameters
- w: Width of the output image
- h: Height of the output image
- mode: Resize mode. NONE - no resize, STRETCH - stretch to fit, LETTERBOX - keep aspect ratio and pad with background color, CENTER_CROP - keep aspect ratio and crop
function
ImageManipConfig & setOutputCenter(bool c)
Centers the content in the output image without resizing
Parameters
- c: True to center the content, false otherwise
function
ImageManipConfig & setColormap(Colormap colormap)
Sets the colormap to be applied to a grayscale image
Parameters
- colormap: Colormap type to be applied
function
ImageManipConfig & setBackgroundColor(uint32_t red, uint32_t green, uint32_t blue)
Sets the rgb background color of the output image
Parameters
- red: Red component of the background color
- green: Green component of the background color
- blue: Blue component of the background color
function
ImageManipConfig & setBackgroundColor(uint32_t val)
Sets the grayscale background color of the output image
Parameters
- val: Grayscale value of the background color
function
ImageManipConfig & setFrameType(ImgFrame::Type frameType)
Sets the frame type of the output image
Parameters
- frameType: Frame type of the output image
function
ImageManipConfig & setUndistort(bool undistort)
Sets the undistort flag
function
bool getUndistort()
Gets the undistort flag
Returns
True if undistort is enabled, false otherwise
function
ImageManipConfig & setReusePreviousImage(bool reuse)
Instruct ImageManip to not remove current image from its queue and use the same for next message.
Parameters
- reuse: True to enable reuse, false otherwise
function
ImageManipConfig & setSkipCurrentImage(bool skip)
Instructs ImageManip to skip current image and wait for next in queue.
Parameters
- skip: True to skip current image, false otherwise
function
bool getReusePreviousImage()
Instruct ImageManip to not remove current image from its queue and use the same for next message.
Returns
True to enable reuse, false otherwise
function
bool getSkipCurrentImage()
Instructs ImageManip to skip current image and wait for next in queue.
Returns
True to skip current image, false otherwise
function
DEPTHAI_SERIALIZE(ImageManipConfig, base, outputFrameType, reusePreviousImage, skipCurrentImage)
inline function
void serialize(std::vector< std::uint8_t > & metadata, DatatypeEnum & datatype)
enum
ImageManipOpsBase< Container >::ResizeMode ResizeMode
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.