Struct ImgDetection

Inheritance Relationships

Derived Type

Struct Documentation

struct ImgDetection

Subclassed by dai::SpatialImgDetection

Public Functions

ImgDetection() = default
ImgDetection(const RotatedRect &boundingBox, float confidence, uint32_t label)
ImgDetection(const RotatedRect &boundingBox, std::string labelName, float confidence, uint32_t label)
ImgDetection(const RotatedRect &boundingBox, const KeypointsList &keypoints, float confidence, uint32_t label)
ImgDetection(const RotatedRect &boundingBox, const KeypointsList &keypoints, std::string labelName, float confidence, uint32_t label)
void setBoundingBox(RotatedRect boundingBox)

Sets the bounding box and the legacy coordinates of the detection.

RotatedRect getBoundingBox() const

Returns bounding box if it was set, else it constructs a new one from the legacy xmin, ymin, xmax, ymax values.

void setOuterBoundingBox(const float xmin, const float ymin, const float xmax, const float ymax)

Sets the bounding box and the legacy coordinates of the detection from the top-left and bottom-right points.

void setKeypoints(const KeypointsList keypoints)

Sets the keypoints of the detection.

Note

This will clear any existing keypoints and edges.

Parameters:

keypoints – list of Keypoint objects to set.

void setKeypoints(const std::vector<Keypoint> keypoints)

Sets the keypoints of the detection.

Note

This will clear any existing keypoints and edges.

Parameters:

keypoints – list of Keypoint objects to set.

void setKeypoints(const std::vector<Keypoint> keypoints, const std::vector<Edge> edges)

Sets the keypoints of the detection.

Note

This will clear any existing keypoints and edges.

Parameters:

keypoints – list of Point2f objects to set.

void setKeypoints(const std::vector<Point3f> keypoints)

Sets the keypoints of the detection.

Note

This will clear any existing keypoints and edges.

Parameters:

keypoints – list of Point3f objects to set.

void setKeypoints(const std::vector<Point2f> keypoints)

Sets the keypoints of the detection.

Note

This will clear any existing keypoints and edges.

Parameters:

keypoints – list of Point2f objects to set.

std::vector<Keypoint> getKeypoints() const

Returns a list of Keypoint objects, or empty list if no keypoints were set.

void setEdges(const std::vector<Edge> edges)

Sets edges for the keypoints, throws if no keypoints were set beforehand.

std::vector<Edge> getEdges() const

Returns a list of edges, each edge is a pair of indices, or empty list if no keypoints were set.

float getCenterX() const noexcept

Returns the X coordinate of the center of the bounding box.

float getCenterY() const noexcept

Returns the Y coordinate of the center of the bounding box.

float getWidth() const noexcept

Returns the width of the (rotated) bounding box.

float getHeight() const noexcept

Returns the height of the (rotated) bounding box.

float getAngle() const noexcept

Returns the angle of the bounding box.

DEPTHAI_SERIALIZE(ImgDetection, label, labelName, confidence, xmin, ymin, xmax, ymax, boundingBox, keypoints)

Public Members

uint32_t label = 0
std::string labelName
float confidence = 0.f
float xmin = 0.f
float ymin = 0.f
float xmax = 0.f
float ymax = 0.f
std::optional<RotatedRect> boundingBox
std::optional<KeypointsList> keypoints