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 ColorCamera or ImageManip.
Note
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.
Examples of functionality¶
Reference¶
-
class
depthai.
ImageManipConfig
-
get
(self: depthai.ImageManipConfig) → depthai.RawImageManipConfig
-
getColormap
(self: depthai.ImageManipConfig) → depthai.Colormap
-
getCropConfig
(self: depthai.ImageManipConfig) → depthai.RawImageManipConfig.CropConfig
-
getCropXMax
(self: depthai.ImageManipConfig) → float
-
getCropXMin
(self: depthai.ImageManipConfig) → float
-
getCropYMax
(self: depthai.ImageManipConfig) → float
-
getCropYMin
(self: depthai.ImageManipConfig) → float
-
getData
(self: object) → numpy.ndarray[numpy.uint8]
-
getFormatConfig
(self: depthai.ImageManipConfig) → depthai.RawImageManipConfig.FormatConfig
-
getInterpolation
(self: depthai.ImageManipConfig) → depthai.Interpolation
-
getRaw
(self: depthai.ADatatype) → depthai.RawBuffer
-
getResizeConfig
(self: depthai.ImageManipConfig) → depthai.RawImageManipConfig.ResizeConfig
-
getResizeHeight
(self: depthai.ImageManipConfig) → int
-
getResizeWidth
(self: depthai.ImageManipConfig) → int
-
getSequenceNum
(self: depthai.Buffer) → int
-
getTimestamp
(self: depthai.Buffer) → datetime.timedelta
-
getTimestampDevice
(self: depthai.Buffer) → datetime.timedelta
-
isResizeThumbnail
(self: depthai.ImageManipConfig) → bool
-
set
(self: depthai.ImageManipConfig, config: depthai.RawImageManipConfig) → depthai.ImageManipConfig
-
setCenterCrop
(self: depthai.ImageManipConfig, ratio: float, whRatio: float = 1.0) → depthai.ImageManipConfig
-
setColormap
(*args, **kwargs) Overloaded function.
setColormap(self: depthai.ImageManipConfig, colormap: depthai.Colormap, min: int, max: int) -> depthai.ImageManipConfig
setColormap(self: depthai.ImageManipConfig, colormap: depthai.Colormap, max: int = 255) -> depthai.ImageManipConfig
setColormap(self: depthai.ImageManipConfig, colormap: depthai.Colormap, max: float = 255.0) -> depthai.ImageManipConfig
-
setCropRect
(*args, **kwargs) Overloaded function.
setCropRect(self: depthai.ImageManipConfig, xmin: float, ymin: float, xmax: float, ymax: float) -> depthai.ImageManipConfig
setCropRect(self: depthai.ImageManipConfig, coordinates: tuple[float, float, float, float]) -> depthai.ImageManipConfig
-
setCropRotatedRect
(self: depthai.ImageManipConfig, rr: depthai.RotatedRect, normalizedCoords: bool = True) → depthai.ImageManipConfig
-
setData
(*args, **kwargs) Overloaded function.
setData(self: depthai.Buffer, arg0: list[int]) -> None
setData(self: depthai.Buffer, arg0: numpy.ndarray[numpy.uint8]) -> None
-
setFrameType
(self: depthai.ImageManipConfig, type: depthai.RawImgFrame.Type) → depthai.ImageManipConfig
-
setHorizontalFlip
(self: depthai.ImageManipConfig, flip: bool) → depthai.ImageManipConfig
-
setInterpolation
(self: depthai.ImageManipConfig, interpolation: depthai.Interpolation) → depthai.ImageManipConfig
-
setKeepAspectRatio
(self: depthai.ImageManipConfig, keep: bool) → depthai.ImageManipConfig
-
setResize
(*args, **kwargs) Overloaded function.
setResize(self: depthai.ImageManipConfig, w: int, h: int) -> depthai.ImageManipConfig
setResize(self: depthai.ImageManipConfig, size: tuple[int, int]) -> depthai.ImageManipConfig
-
setResizeThumbnail
(*args, **kwargs) Overloaded function.
setResizeThumbnail(self: depthai.ImageManipConfig, w: int, h: int, bgRed: int = 0, bgGreen: int = 0, bgBlue: int = 0) -> depthai.ImageManipConfig
setResizeThumbnail(self: depthai.ImageManipConfig, size: tuple[int, int], bgRed: int = 0, bgGreen: int = 0, bgBlue: int = 0) -> depthai.ImageManipConfig
-
setReusePreviousImage
(self: depthai.ImageManipConfig, reuse: bool) → depthai.ImageManipConfig
-
setRotationDegrees
(self: depthai.ImageManipConfig, deg: float) → depthai.ImageManipConfig
-
setRotationRadians
(self: depthai.ImageManipConfig, rad: float) → depthai.ImageManipConfig
-
setSequenceNum
(self: depthai.Buffer, arg0: int) → depthai.Buffer
-
setSkipCurrentImage
(self: depthai.ImageManipConfig, skip: bool) → depthai.ImageManipConfig
-
setTimestamp
(self: depthai.Buffer, arg0: datetime.timedelta) → depthai.Buffer
-
setTimestampDevice
(self: depthai.Buffer, arg0: datetime.timedelta) → depthai.Buffer
-
setVerticalFlip
(self: depthai.ImageManipConfig, flip: bool) → None
-
setWarpBorderFillColor
(self: depthai.ImageManipConfig, red: int, green: int, blue: int) → depthai.ImageManipConfig
-
setWarpBorderReplicatePixels
(self: depthai.ImageManipConfig) → depthai.ImageManipConfig
-
setWarpTransformFourPoints
(self: depthai.ImageManipConfig, pt: list[depthai.Point2f], normalizedCoords: bool) → depthai.ImageManipConfig
-
setWarpTransformMatrix3x3
(self: depthai.ImageManipConfig, mat: list[float]) → depthai.ImageManipConfig
-
-
class
dai
::
ImageManipConfig
: public dai::Buffer¶ ImageManipConfig message. Specifies image manipulation options like:
Crop
Resize
Warp
…
Public Types
-
using
CropConfig
= RawImageManipConfig::CropConfig¶
-
using
ResizeConfig
= RawImageManipConfig::ResizeConfig¶
-
using
FormatConfig
= RawImageManipConfig::FormatConfig¶
Public Functions
-
ImageManipConfig
()¶ Construct ImageManipConfig message.
-
~ImageManipConfig
() = default¶
-
ImageManipConfig &
setCropRect
(float xmin, float ymin, float xmax, float ymax)¶ Specifies crop with rectangle with normalized values (0..1)
- Parameters
xmin
: Top left X coordinate of rectangleymin
: Top left Y coordinate of rectanglexmax
: Bottom right X coordinate of rectangleymax
: Bottom right Y coordinate of rectangle
-
ImageManipConfig &
setCropRect
(std::tuple<float, float, float, float> coordinates)¶ Specifies crop with rectangle with normalized values (0..1)
- Parameters
coordinates
: Coordinate of rectangle
-
ImageManipConfig &
setCropRotatedRect
(RotatedRect rr, bool normalizedCoords = true)¶ Specifies crop with rotated rectangle. Optionally as non normalized coordinates
- Parameters
rr
: Rotated rectangle which specifies cropnormalizedCoords
: If true coordinates are in normalized range (0..1) otherwise absolute
-
ImageManipConfig &
setCenterCrop
(float ratio, float whRatio = 1.0f)¶ Specifies a centered crop.
- Parameters
ratio
: Ratio between input image and crop region (0..1)whRatio
: Crop region aspect ratio - 1 equals to square, 1.7 equals to 16:9, …
-
ImageManipConfig &
setWarpTransformFourPoints
(std::vector<Point2f> pt, bool normalizedCoords)¶ Specifies warp by supplying 4 points in either absolute or normalized coordinates
- Parameters
pt
: 4 points specifying warpnormalizedCoords
: If true pt is interpreted as normalized, absolute otherwise
-
ImageManipConfig &
setWarpTransformMatrix3x3
(std::vector<float> mat)¶ Specifies warp with a 3x3 matrix
- Parameters
mat
: 3x3 matrix
-
ImageManipConfig &
setWarpBorderReplicatePixels
()¶ Specifies that warp replicates border pixels
-
ImageManipConfig &
setWarpBorderFillColor
(int red, int green, int blue)¶ Specifies fill color for border pixels. Example:
setWarpBorderFillColor(255,255,255) -> white
setWarpBorderFillColor(0,0,255) -> blue
- Parameters
red
: Red componentgreen
: Green componentblue
: Blue component
-
ImageManipConfig &
setRotationDegrees
(float deg)¶ Specifies clockwise rotation in degrees
- Parameters
deg
: Rotation in degrees
-
ImageManipConfig &
setRotationRadians
(float rad)¶ Specifies clockwise rotation in radians
- Parameters
rad
: Rotation in radians
-
ImageManipConfig &
setResize
(int w, int h)¶ Specifies output image size. After crop stage the image will be stretched to fit.
- Parameters
w
: Width in pixelsh
: Height in pixels
-
ImageManipConfig &
setResize
(std::tuple<int, int> size)¶ Specifies output image size. After crop stage the image will be stretched to fit.
- Parameters
size
: Size in pixels
-
ImageManipConfig &
setResizeThumbnail
(int w, int h, int bgRed = 0, int bgGreen = 0, int bgBlue = 0)¶ Specifies output image size. After crop stage the image will be resized by preserving aspect ration. Optionally background can be specified.
- Parameters
w
: Width in pixelsh
: Height in pixelsbgRed
: Red componentbgGreen
: Green componentbgBlue
: Blue component
-
ImageManipConfig &
setResizeThumbnail
(std::tuple<int, int> size, int bgRed = 0, int bgGreen = 0, int bgBlue = 0)¶ Specifies output image size. After crop stage the image will be resized by preserving aspect ration. Optionally background can be specified.
- Parameters
size
: Size in pixelsbgRed
: Red componentbgGreen
: Green componentbgBlue
: Blue component
-
ImageManipConfig &
setFrameType
(ImgFrame::Type name)¶ Specify output frame type.
- Parameters
name
: Frame type
-
ImageManipConfig &
setColormap
(Colormap colormap, int min, int max)¶ Specify gray to color conversion map
- Parameters
colormap
: map from Colormap enum or Colormap::NONE to disable
-
ImageManipConfig &
setColormap
(Colormap colormap, float maxf)¶
-
ImageManipConfig &
setColormap
(Colormap colormap, int max = 255)¶
-
ImageManipConfig &
setHorizontalFlip
(bool flip)¶ Specify horizontal flip
- Parameters
flip
: True to enable flip, false otherwise
-
void
setVerticalFlip
(bool flip)¶ Specify vertical flip
- Parameters
flip
: True to enable vertical flip, false otherwise
-
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
-
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
-
ImageManipConfig &
setKeepAspectRatio
(bool keep)¶ Specifies to whether to keep aspect ratio or not
-
ImageManipConfig &
setInterpolation
(dai::Interpolation interpolation)¶ Specify which interpolation method to use
- Parameters
interpolation
: type of interpolation
-
float
getCropXMin
() const¶ - Return
Top left X coordinate of crop region
-
float
getCropYMin
() const¶ - Return
Top left Y coordinate of crop region
-
float
getCropXMax
() const¶ - Return
Bottom right X coordinate of crop region
-
float
getCropYMax
() const¶ - Return
Bottom right Y coordinate of crop region
-
int
getResizeWidth
() const¶ - Return
Output image width
-
int
getResizeHeight
() const¶ - Return
Output image height
-
CropConfig
getCropConfig
() const¶ - Return
Crop configuration
-
ResizeConfig
getResizeConfig
() const¶ - Return
Resize configuration
-
FormatConfig
getFormatConfig
() const¶ - Return
Format configuration
-
bool
isResizeThumbnail
() const¶ - Return
True if resize thumbnail mode is set, false otherwise
-
ImageManipConfig &
set
(dai::RawImageManipConfig config)¶ Set explicit configuration.
- Parameters
config
: Explicit configuration
-
dai::RawImageManipConfig
get
() const¶ Retrieve configuration data for ImageManip.
- Return
config for ImageManip
-
dai::Interpolation
getInterpolation
() const¶ Retrieve which interpolation method to use.
Private Members
-
RawImageManipConfig &
cfg
¶