Go to the documentation of this file.
6 Warp::Warp(
const std::shared_ptr<PipelineImpl>& par, int64_t nodeId, std::unique_ptr<Properties> props)
35 if(numMeshPoints < width * height) {
36 throw std::invalid_argument(
"Not enough points provided for specified width and height");
44 constexpr
auto ALIGNMENT = 16;
45 size_t meshStride = ((size_t)((
sizeof(
Point2f) * width)) + (ALIGNMENT - 1)) & ~(ALIGNMENT - 1);
47 size_t meshSize = meshStride * height;
50 asset.
data = std::vector<uint8_t>(meshSize);
53 for(
int i = 0; i < height; i++) {
54 for(
int j = 0; j < width; j++) {
56 size_t inputMeshIndex = (i * width + j) * 2;
59 size_t outputMeshOffset = (meshStride * i) + (j *
sizeof(
Point2f));
60 auto& point =
reinterpret_cast<Point2f&
>(asset.
data.data()[outputMeshOffset]);
63 point.
x = meshData[inputMeshIndex + 1];
64 point.y = meshData[inputMeshIndex + 0];
74 setWarpMesh(
reinterpret_cast<const float*
>(meshData.data()),
static_cast<int>(meshData.size()), width, height);
77 void Warp::setWarpMesh(
const std::vector<std::pair<float, float>>& meshData,
int width,
int height) {
78 setWarpMesh(
reinterpret_cast<const float*
>(meshData.data()),
static_cast<int>(meshData.size()), width, height);
Properties & properties
Underlying properties.
int outputWidth
Output width.
Interpolation interpolation
Interpolation type to use.
void setInputRefs(std::initializer_list< Input * > l)
void setNumFramesPool(int numFramesPool)
AssetManager assetManager
std::vector< std::uint8_t > data
void setHwIds(std::vector< int > ids)
void setOutputSize(std::tuple< int, int > size)
int outputFrameSize
Maximum output frame size in bytes (eg: 300x300 BGR image -> 300*300*3 bytes)
Asset is identified with string key and can store arbitrary binary data.
int meshWidth
Custom warp mesh width. Set to zero to disable.
void setMaxOutputFrameSize(int maxFrameSize)
Warp node. Capability to crop, resize, warp, ... incoming image frames.
constexpr auto size(const C &c) -> decltype(c.size())
int meshHeight
Custom warp mesh height. Set to zero to disable.
void setWarpMesh(const float *meshData, int numMeshPoints, int width, int height)
std::shared_ptr< dai::Asset > set(Asset asset)
int numFramesPool
Num frames in output pool.
int outputHeight
Output height.
Properties & getProperties()
Base Properties structure.
dai::Interpolation getInterpolation() const
Retrieve which interpolation method to use.
Warp(const std::shared_ptr< PipelineImpl > &par, int64_t nodeId)
void setOutputRefs(std::initializer_list< Output * > l)
std::string meshUri
Custom warp mesh uri. Set to empty string to disable.
std::vector< int > warpHwIds
Warp HW IDs to use, if empty, use auto/default.
void setInterpolation(dai::Interpolation interpolation)
std::vector< int > getHwIds() const
Retrieve which hardware warp engines to use.
depthai
Author(s): Martin Peterlin
autogenerated on Sat Mar 22 2025 02:58:19