Go to the documentation of this file.
6 ImageManip::ImageManip(
const std::shared_ptr<PipelineImpl>& par, int64_t nodeId, std::unique_ptr<Properties> props)
9 initialConfig(rawConfig) {
73 if(numMeshPoints < width * height) {
74 throw std::invalid_argument(
"Not enough points provided for specified width and height");
82 constexpr
auto ALIGNMENT = 16;
83 size_t meshStride = ((size_t)((
sizeof(
Point2f) * width)) + (ALIGNMENT - 1)) & ~(ALIGNMENT - 1);
85 size_t meshSize = meshStride * height;
88 asset.
data = std::vector<uint8_t>(meshSize);
91 for(
int i = 0; i < height; i++) {
92 for(
int j = 0; j < width; j++) {
94 size_t inputMeshIndex = (i * width + j) * 2;
97 size_t outputMeshOffset = (meshStride * i) + (j *
sizeof(
Point2f));
98 auto& point =
reinterpret_cast<Point2f&
>(asset.
data.data()[outputMeshOffset]);
101 point.
x = meshData[inputMeshIndex + 1];
102 point.y = meshData[inputMeshIndex + 0];
112 setWarpMesh(
reinterpret_cast<const float*
>(meshData.data()),
static_cast<int>(meshData.size()), width, height);
116 setWarpMesh(
reinterpret_cast<const float*
>(meshData.data()),
static_cast<int>(meshData.size()), width, height);
Properties & properties
Underlying properties.
void setHorizontalFlip(bool flip)
ImageManipConfig & setCropRect(float xmin, float ymin, float xmax, float ymax)
void setInputRefs(std::initializer_list< Input * > l)
void setNumFramesPool(int numFramesPool)
ImageManipConfig & setCenterCrop(float ratio, float whRatio=1.0f)
void setKeepAspectRatio(bool keep)
AssetManager assetManager
std::vector< std::uint8_t > data
RawImageManipConfig structure.
int meshWidth
Custom warp mesh width. Set to zero to disable.
void setResizeThumbnail(int w, int h, int bgRed=0, int bgGreen=0, int bgBlue=0)
bool getWaitForConfigInput() const
RawImageManipConfig initialConfig
Initial configuration for ImageManip node.
void setCenterCrop(float ratio, float whRatio=1.0f)
ImageManipConfig & setHorizontalFlip(bool flip)
Asset is identified with string key and can store arbitrary binary data.
ImageManipConfig & setResize(int w, int h)
std::string meshUri
Custom warp mesh uri. Set to empty string to disable.
ImageManipConfig & setFrameType(ImgFrame::Type name)
void setWarpMesh(const float *meshData, int numMeshPoints, int width, int height)
std::shared_ptr< dai::Asset > set(Asset asset)
void setResize(int w, int h)
int numFramesPool
Num frames in output pool.
void setCropRect(float xmin, float ymin, float xmax, float ymax)
Base Properties structure.
void setMaxOutputFrameSize(int maxFrameSize)
ImageManip node. Capability to crop, resize, warp, ... incoming image frames.
void setOutputRefs(std::initializer_list< Output * > l)
int outputFrameSize
Maximum output frame size in bytes (eg: 300x300 BGR image -> 300*300*3 bytes)
int meshHeight
Custom warp mesh height. Set to zero to disable.
ImageManipConfig initialConfig
ImageManip(const std::shared_ptr< PipelineImpl > &par, int64_t nodeId)
Properties & getProperties()
void setFrameType(ImgFrame::Type name)
ImageManipConfig & setKeepAspectRatio(bool keep)
std::shared_ptr< RawImageManipConfig > rawConfig
void setWaitForConfigInput(bool wait)
ImageManipConfig & setResizeThumbnail(int w, int h, int bgRed=0, int bgGreen=0, int bgBlue=0)
depthai
Author(s): Martin Peterlin
autogenerated on Sat Mar 22 2025 02:58:19