Back to Adaptive Vision Library website

You are here: Start » Function Reference » Region Features » RegionBoundingRectangle


Header: AVL.h
Namespace: avl
Module: FoundationBasic

Computes the smallest rectangle containing a region.


void avl::RegionBoundingRectangle
	const avl::Region& inRegion,
	avl::BoundingRectangleFeature::Type inBoundingRectangleFeature,
	float inReferenceAngle,
	avl::RectangleOrientation::Type inRectangleOrientation,
	avl::Rectangle2D& outBoundingRectangle,
	atl::Optional<avl::Point2D&> outCenter = atl::NIL,
	atl::Optional<float&> outLongSide = atl::NIL,
	atl::Optional<float&> outShortSide = atl::NIL


Name Type Default Description
inRegion const Region& Input region
inBoundingRectangleFeature BoundingRectangleFeature::Type MinimalArea Determines what kind of bounding rectangle will be computed
inReferenceAngle float 0.0f The middle angle of the valid range of the output rectangle's angle
inRectangleOrientation RectangleOrientation::Type Horizontal Orientation of the output rectangle
outBoundingRectangle Rectangle2D& The smallest bounding rectangle of the input region
outCenter Optional<Point2D&> NIL Center of the bounding rectangle
outLongSide Optional<float&> NIL Length of the bounding rectangle long side
outShortSide Optional<float&> NIL Length of the bounding rectangle short side

Optional Outputs

The computation of following outputs can be switched off by passing value atl::NIL to these parameters: outCenter, outLongSide, outShortSide.

Read more about Optional Outputs.


The filter computes a rectangle with the smallest possible selected feature that contains all pixels belonging to the input region. The angle of the resulting rectangle is then normalized as in the NormalizeRectangleOrientation filter.


  • If the input region is not guaranteed to be non-empty, precede this filter with SkipEmptyRegion.


RegionBoundingRectangle performed on a sample region with inRectangleOrientation set on Vertical.


List of possible exceptions:

Error type Description
DomainError Empty region on input in RegionBoundingRectangle.

See Also