HALCON Reference Manual 10.0.2
Table of Contents / Regions / Features ClassesClassesClasses | | | Operators

compactnesscompactnesscompactnessCompactnessCompactness (Operator)

Name

compactnesscompactnesscompactnessCompactnessCompactness — Shape factor for the compactness of a region.

Signature

compactness(Regions : : : Compactness)

Herror compactness(const Hobject Regions, double* Compactness)

Herror T_compactness(const Hobject Regions, Htuple* Compactness)

Herror compactness(Hobject Regions, double* Compactness)

Herror compactness(Hobject Regions, HTuple* Compactness)

double HRegion::Compactness() const

HTuple HRegionArray::Compactness() const

void HOperatorSetX.Compactness(
[in] IHUntypedObjectX* Regions, [out] VARIANT* Compactness)

VARIANT HRegionX.Compactness()

static void HOperatorSet.Compactness(HObject regions, out HTuple compactness)

HTuple HRegion.Compactness()

Description

The operator compactnesscompactnesscompactnessCompactnessCompactness calculates the compactness of the input regions.

Calculation:

If L is the length of the contour (see contlengthcontlengthcontlengthContlengthContlength) and F the area of the region the shape factor C is defined as:

C = L^2 / (4 F pi))

The shape factor C of a circle is 1. If the region is long or has holes C is larger than 1. The operator compactnesscompactnesscompactnessCompactnessCompactness responds to the course of the contour (roughness) and to holes. In case of an empty region the operator compactnesscompactnesscompactnessCompactnessCompactness returns the value 0 if no other behavior was set (see set_systemset_systemset_systemSetSystemSetSystem). If more than one region is passed the numerical values of the shape factor are stored in a tuple, the position of a value in the tuple corresponding to the position of the region in the input tuple.

Parallelization

Parameters

RegionsRegionsRegionsRegionsregions (input_object)  region(-array) objectHRegionHRegionHRegionXHobject

Region(s) to be examined.

CompactnessCompactnessCompactnessCompactnesscompactness (output_control)  real(-array) HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Compactness of the input region(s).

Assertion: (Compactness >= 1.0) || (Compactness == 0)

Result

The operator compactnesscompactnesscompactnessCompactnessCompactness returns the value 2 (H_MSG_TRUE) if the input is not empty. The behavior in case of empty input (no input regions available) is set via the operator set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>). The behavior in case of empty region (the region is the empty set) is set via set_system('empty_region_result',<Result>)set_system("empty_region_result",<Result>)set_system("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>). If necessary an exception is raised.

Possible Predecessors

thresholdthresholdthresholdThresholdThreshold, regiongrowingregiongrowingregiongrowingRegiongrowingRegiongrowing, connectionconnectionconnectionConnectionConnection

Alternatives

compactnesscompactnesscompactnessCompactnessCompactness, convexityconvexityconvexityConvexityConvexity, eccentricityeccentricityeccentricityEccentricityEccentricity

See also

contlengthcontlengthcontlengthContlengthContlength, area_centerarea_centerarea_centerAreaCenterAreaCenter, select_shapeselect_shapeselect_shapeSelectShapeSelectShape

Module

Foundation


Table of Contents / Regions / Features ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH