Back to Adaptive Vision Library website

You are here: Start » Function Reference » Region Global Transforms » SplitRegionIntoComponents

SplitRegionIntoComponents


Header: AVL.h
Namespace: avl
Module: FoundationBasic

Splits a region into an array of regions. Operates by merging blobs in accordance to the inMaxDistance parameter.

Syntax

C++
C#
 
void avl::SplitRegionIntoComponents
(
	const avl::Region& inRegion,
	atl::Optional<int> inMaxDistance,
	float inDistanceBalance,
	atl::Optional<float> inMaxJointDiameter,
	atl::Optional<int> inMaxJointWidth,
	atl::Optional<int> inMaxJointHeight,
	const int inMinComponentArea,
	atl::Optional<int> inMaxComponentArea,
	bool inRemoveBoundaryBlobs,
	atl::Array<avl::Region>& outComponents
)

Parameters

Name Type Range Default Description
inRegion const Region& Input region
inMaxDistance Optional<int> 0 - 5
inDistanceBalance float -1.0 - 1.0 Defines how much important the distance between regions in x coordinate is according to distance in y coordinate
inMaxJointDiameter Optional<float> 0.0 - NIL
inMaxJointWidth Optional<int> 0 - NIL
inMaxJointHeight Optional<int> 0 - NIL
inMinComponentArea const int 0 - 1 Minimal area of a resulting component
inMaxComponentArea Optional<int> 0 - NIL Maximal area of a resulting component
inRemoveBoundaryBlobs bool False Flag indicating whether the blobs on border of the input region should be removed or not
outComponents Array<Region>&

Description

The filter splits the input region into blobs and iteratively joins some of them into bigger components. Only blobs that are distant from each other by at most inMaxDistance can be joined. The joining order is determined based on modified distance between two blobs, so the closest ones are joined first. This modified distance between two blobs is computed as follows:
  1. The shortest segment connecting two blobs is computed.
  2. The segment is scaled by \[ 0.5 \cdot (1 + inDistanceBalance) \] along the X axis and by \[ 0.5 \cdot (1 - inDistanceBalance) \] along the Y axis.
  3. Finally the length of the so scaled segment is computed.
Every region being a result of such blob joining has to satisfy conditions defined by inMaxJointDiameter, inMaxJointWidth and inMaxJointHeight parameters. Finally, only regions with appropriate area between inMinComponentArea and inMaxComponentArea are parts of the output component table.

Examples

SplitRegionIntoComponents used with inMaxDistance = 50.

Remarks

This filter is mostly used in Blob Analysis Technique please refer to our Machine Vision Guide - Blob Analysis article.

See Also

  • SplitRegionIntoBlobs – Splits a region into an array of regions corresponding to its connected components.