Back to Adaptive Vision Library website

You are here: Start » Function Reference » Shape Features » ShapeCircularity

ShapeCircularity


Header:AVL.h
Namespace:avl

Computes the area of a shape divided by the area of a circle having the same feature.

Syntax

C++
C#
 
void avl::ShapeCircularity
(
	const avl::Path& inShape,
	const avl::CircularityMeasure::Type inCircularityMeasure,
	float& outCircularity
)

Parameters

Name Type Default Description
inShape const Path&
inCircularityMeasure const CircularityMeasure::Type RadiusPreserving
outCircularity float&

Description

Circularity is a measure of similarity of a shape to the perfect circle. Circular shapes have circularity close to 1.0, while the more elongated the shape is (or contains more holes), the closer to 0.0 is its circularity.

Mathematically, the circularity is calculated as follows: Where c denotes a circular shape having the same feature as input shape s. The feature being considered depends on the inCircularityMeasure chosen and it is:

  • the minimal bounding circle in case of BoundingCirclePreserving
  • the perimeter in case of PerimeterPreserving
  • the radius (maximal distance from mass center to any of the shape points) in case of RadiusPreserving

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

Circularity with RadiusPreserving of the sample shape equals to 0.340.

Circularity with PerimeterPreserving of the sample shape equals to 0.998.

Errors

List of possible exceptions:

Error type Description
DomainError Degenerate shape on input in ShapeCircularity.
DomainError Not supported circularity measure in ShapeCircularity.
DomainError Open path on input in ShapeCircularity.

See Also

  • RegionCircularity – Computes the area of a region divided by the area of a circular region having the same feature.
  • ShapeConvexity – Computes the area of a shape divided by the area of its convex hull.
  • ShapeElongation – Computes the elongation factor of a shape (perfect circle has minimal elongation equal 1.0).