Back to Adaptive Vision Library website
You are here: Start » Function Reference » Shape Features » ShapeConvexity
ShapeConvexity
Computes the area of a shape divided by the area of its convex hull.
Header: | AVL.h |
---|
Syntax
C++
C#
void avl::ShapeConvexity ( const avl::Path& inShape, float& outConvexity )
Parameters
Name | Type | Default | Description | |
---|---|---|---|---|
inShape | const Path& | |||
outConvexity | float& |
Description
Convexity is a measure of how close a shape is to being convex. Convex shapes have convexity equal to 1.0, while the more concave the shape is, the closer to 0.0 is its convexity.
Mathematically, the convexity is calculated as follows:
Note that if the input path is not a valid shape (i.e. it has at least one self-intersection), the computation may lead to results that are not intuitive.
Examples
Errors
Error type | Description |
---|---|
DomainError | Open path on input in ShapeConvexity. |
DomainError | Degenerate shape on input in ShapeConvexity. |
See Also
- PathConvexHull – Computes the smallest convex shape that contains the given path.
- RegionConvexity – Computes the area of a region divided by area of its convex hull.
- ShapeCircularity – Computes the area of a shape divided by the area of a circle having the same feature.
- ShapeElongation – Computes the elongation factor of a shape (perfect circle has minimal elongation equal 1.0).