-
Notifications
You must be signed in to change notification settings - Fork 0
API‐Contour‐Analysis
Namespace: acl::contour
Contour geometry analysis. Input is std::vector<acl::Point2i> (typically produced by findContours).
Tier: Pro+
NEON: none (geometric computation, pure CPP)
Related structs
struct acl::Point2i { int x, y; }; // input point type
struct acl::Rect { int x, y, width, height; };
struct acl::Point2f { float x, y; };
struct acl::Size2f { float width, height; };
struct acl::RotatedRect { Point2f center; Size2f size; float angle; };Compute polygon area via the Shoelace formula.
Tier: Pro+
Channels: N/A (point set)
Inplace: not supported
Types:
| Template parameter | Allowed types | Constraint |
|---|---|---|
| Input | std::vector<acl::Point2i> |
— |
| Output | double |
— |
double contourArea(
const std::vector<acl::Point2i>& contour,
bool oriented = false);| Parameter | Type | Meaning | Default |
|---|---|---|---|
contour |
point array | Contour (at least 3 points, otherwise returns 0) |
— |
oriented |
bool |
true = signed area (positive = counter-clockwise, negative = clockwise); false = absolute value |
false |
The return value is the area (not an error code).
Contour perimeter (sum of Euclidean distances between consecutive points).
Tier: Pro+
Channels: N/A (point set)
Inplace: not supported
Types:
| Template parameter | Allowed types | Constraint |
|---|---|---|
| Input | std::vector<acl::Point2i> |
— |
| Output | double |
— |
double arcLength(
const std::vector<acl::Point2i>& contour,
bool closed = true);| Parameter | Type | Meaning | Default |
|---|---|---|---|
closed |
bool |
true = closed (including last point → first point); false = open |
true |
The return value is the length (not an error code).
Compute the axis-aligned bounding rectangle of a contour.
Tier: Pro+
Channels: N/A (point set)
Inplace: not supported
Types:
| Template parameter | Allowed types | Constraint |
|---|---|---|
| Input | std::vector<acl::Point2i> |
— |
| Output | acl::Rect |
— |
acl::Rect boundingRect(
const std::vector<acl::Point2i>& contour);Returns a
Rect(not an error code). An empty contour returnsRect(0, 0, 0, 0).
Compute the convex hull using Andrew's monotone chain algorithm.
Tier: Pro+
Channels: N/A (point set)
Inplace: not supported
Types:
| Template parameter | Allowed types | Constraint |
|---|---|---|
| input/output | std::vector<acl::Point2i> |
— |
int convexHull(
const std::vector<acl::Point2i>& points,
std::vector<acl::Point2i>& hull);The output
hullis arranged in counter-clockwise order.
Simplify a polygon (reduce the number of vertices) using the Douglas-Peucker algorithm.
Tier: Pro+
Channels: N/A (point set)
Inplace: not supported
Types:
| Template parameter | Allowed types | Constraint |
|---|---|---|
| input/output | std::vector<acl::Point2i> |
— |
int approxPolyDP(
const std::vector<acl::Point2i>& curve,
std::vector<acl::Point2i>& approx,
double epsilon,
bool closed = true);| Parameter | Type | Meaning | Default |
|---|---|---|---|
epsilon |
double |
Maximum distance between the original curve and the simplified curve | — |
closed |
bool |
Treat as a closed contour | true |
Compute the minimum-area rotated bounding rectangle using rotating calipers.
Tier: Pro+
Channels: N/A (point set)
Inplace: not supported
Types:
| Template parameter | Allowed types | Constraint |
|---|---|---|
| Input | std::vector<acl::Point2i> |
— |
| Output | acl::RotatedRect |
— |
int minAreaRect(
const std::vector<acl::Point2i>& points,
acl::RotatedRect& result);The input requires at least 3 points (0 points returns an error; 1-2 points returns a degenerate Rect).
Fit an ellipse via Direct Least Squares; outputs the ellipse's rotated-rectangle description.
Tier: Pro+
Channels: N/A (point set)
Inplace: not supported
Types:
| Template parameter | Allowed types | Constraint |
|---|---|---|
| Input | std::vector<acl::Point2i> |
≥5 |
| Output | acl::RotatedRect |
— |
int fitEllipse(
const std::vector<acl::Point2i>& points,
acl::RotatedRect& result);The input requires at least 5 points.