You are here: Start » AVL.NET » Function Reference » Region » Region Global Transforms » AVL.SplitRegionIntoExactlyNComponents

AVL.SplitRegionIntoExactlyNComponents

Splits a region into a fixed-size array of regions.

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax

C++
C#
 
public static void SplitRegionIntoExactlyNComponents
(
	AvlNet.Region inRegion,
	int inComponentCount,
	int? inMaxDistance,
	float inDistanceBalance,
	float? inMaxJointDiameter,
	int? inMaxJointWidth,
	int? inMaxJointHeight,
	bool inRemoveBoundaryBlobs,
	INullable<SafeList<AvlNet.Region>> outComponents
)

Parameters

Name Type Range Default Description
inRegionAvlNet.RegionInput region.
inComponentCountint<1, INF>
inMaxDistanceint?<0, INF>5Default value: 5.
inDistanceBalancefloat<-1.0f, 1.0f>Defines how much important the distance between regions in x coordinate is according to distance in y coordinate.
inMaxJointDiameterfloat?<0.0f, INF>
inMaxJointWidthint?<0, INF>
inMaxJointHeightint?<0, INF>
inRemoveBoundaryBlobsboolFalseFlag indicating whether the blobs on border of the input region should be removed or not. Default value: False.
outComponentsAvlNet.INullable<AvlNet.SafeList<AvlNet.Region>> This parameter cannot be null.

Description

The filter splits the input region into blobs and iteratively joins some of them into bigger components until only inComponentCount components remain. 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.

Examples

SplitRegionIntoExactlyNComponents used with inComponentCount = 4.

Remarks

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

Function Overrides

See also