Struct SpatialImgDetection
Defined in File SpatialImgDetections.hpp
Struct Documentation
-
struct SpatialImgDetection
SpatialImgDetection structure
Contains image detection results together with spatial location data.
Public Functions
-
SpatialImgDetection() = default
-
SpatialImgDetection(const RotatedRect &boundingBox, Point3f spatialCoordinates, float confidence = 1.f, uint32_t label = 0)
-
SpatialImgDetection(const RotatedRect &boundingBox, Point3f spatialCoordinates, std::string labelName, float confidence, uint32_t label)
-
SpatialImgDetection(const RotatedRect &boundingBox, Point3f spatialCoordinates, const SpatialKeypointsList &keypoints, float confidence = 1.f, uint32_t label = 0)
-
SpatialImgDetection(const RotatedRect &boundingBox, Point3f spatialCoordinates, const SpatialKeypointsList &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 SpatialKeypointsList 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<SpatialKeypoint> 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<SpatialKeypoint> 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 setSpatialCoordinate(const Point3f spatialCoordinates)
Sets spatial coordinates for the detection.
Note
The size of spatialCoordinates.
- Parameters:
spatialCoordinates – list of Point3f objects to set.
-
void setEdges(const std::vector<Edge> edges)
Sets edges for the keypoints, throws if no keypoints were set beforehand.
-
dai::ImgDetection getImgDetection() const
Converts SpatialImgDetection to ImgDetection by dropping spatial data.
- Returns:
dai::ImgDetection object.
-
std::vector<SpatialKeypoint> getKeypoints() const
Returns a list of Keypoint objects, or empty list if no keypoints were set.
-
std::vector<dai::Point3f> getKeypointSpatialCoordinates() const
Returns a list of spatial coordinates for each keypoint, or empty list if no keypoints were set.
-
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
Returns the X coordinate of the center of the bounding box.
-
float getCenterY() const
Returns the Y coordinate of the center of the bounding box.
-
float getWidth() const
Returns the width of the (rotated) bounding box.
-
float getHeight() const
Returns the height of the (rotated) bounding box.
-
float getAngle() const
Returns the angle of the bounding box.
-
DEPTHAI_SERIALIZE(SpatialImgDetection, label, labelName, confidence, xmin, ymin, xmax, ymax, boundingBox, keypoints, spatialCoordinates, boundingBoxMapping)
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<SpatialKeypointsList> keypoints
-
SpatialLocationCalculatorConfigData boundingBoxMapping
-
SpatialImgDetection() = default