Skip to content

roundnessRoundnessRoundnessroundnessroundnessπŸ”—

Short descriptionπŸ”—

roundnessRoundnessRoundnessroundnessroundness β€” Shape factors from contour.

SignatureπŸ”—

roundness( region Regions, out real Distance, out real Sigma, out real Roundness, out real Sides )void Roundness( const HObject& Regions, HTuple* Distance, HTuple* Sigma, HTuple* Roundness, HTuple* Sides )static void HOperatorSet.Roundness( HObject regions, out HTuple distance, out HTuple sigma, out HTuple roundness, out HTuple sides )def roundness( regions: HObject ) -> Tuple[Sequence[float], Sequence[float], Sequence[float], Sequence[float]]

def roundness_s( regions: HObject ) -> Tuple[float, float, float, float]Herror roundness( const Hobject Regions, double* Distance, double* Sigma, double* Roundness, double* Sides )

Herror T_roundness( const Hobject Regions, Htuple* Distance, Htuple* Sigma, Htuple* Roundness, Htuple* Sides )

HTuple HRegion::Roundness( HTuple* Sigma, HTuple* Roundness, HTuple* Sides ) const

double HRegion::Roundness( double* Sigma, double* Roundness, double* Sides ) const

HTuple HRegion.Roundness( out HTuple sigma, out HTuple roundness, out HTuple sides )

double HRegion.Roundness( out double sigma, out double roundness, out double sides )

DescriptionπŸ”—

The operator roundnessRoundness examines the distance between the contour and the center of the area. In particular the mean distance (Distancedistancedistance), the deviation from the mean distance (Sigmasigmasigma) and two shape features derived therefrom are determined. Roundnessroundnessroundness is the relation between mean value and standard deviation, and Sidessidessides indicates the number of polygon pieces if a regular polygon is concerned.

In the documentation of this chapter (Regions / Features), you can find an image illustrating regions which vary in their mean distance, distance deviation, roundness and number of polygon pieces.

The contour for calculating the features is determined depending on the global neighborhood (see set_systemSetSystem).

Calculation:

If \(p\) is the center of the area, \(p_{i}\) the pixels and \(F\) the area of the contour.

\[\begin{eqnarray*} \textrm{Distance} = \frac{1}{F} \sum{||p - p_{i}||} \end{eqnarray*}\]
\[\begin{eqnarray*} \textrm{Sigma}^2 = \frac{1}{F} \sum{\left(||p - p_{i}|| - \textrm{Distance}\right)^2} \end{eqnarray*}\]
\[\begin{eqnarray*} \textrm{Roundness} = 1-\frac{\textrm{Sigma}}{\textrm{Distance}} \end{eqnarray*}\]
\[\begin{eqnarray*} \textrm{Sides} = 1.4111 \left(\frac{\textrm{Distance}}{\textrm{Sigma}}\right)^{0.4724}\end{eqnarray*}\]

If more than one region is passed the results are stored in tuples, the index of a value in the tuple corresponding to the index of a region in the input.

In case of empty region all parameters have the value 0.0 if no other behavior was set (see set_systemSetSystem).

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on tuple level.

ParametersπŸ”—

Regionsregionsregions (input_object) region(-array) β†’ objectHObjectHRegionHObjectHobject

Region(s) to be examined.

Distancedistancedistance (output_control) real(-array) β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Mean distance from the center.

Assertion: Distance >= 0.0

Sigmasigmasigma (output_control) real(-array) β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Standard deviation of Distancedistancedistance.

Assertion: Sigma >= 0.0

Roundnessroundnessroundness (output_control) real(-array) β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Shape factor for roundness.

Assertion: Roundness <= 1.0

Sidessidessides (output_control) real(-array) β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Number of polygon sides.

Assertion: Sides >= 0

ComplexityπŸ”—

If \(F\) is the area of a region the mean runtime complexity is \(O(\sqrt{F})\).

ResultπŸ”—

The operator roundnessRoundness 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>), the behavior in case of empty region is set via set_system('empty_region_result',<Result>). If necessary an exception is raised.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

thresholdThreshold, regiongrowingRegiongrowing, connectionConnection

Alternatives

compactnessCompactness

See also

contlengthContlength

ReferencesπŸ”—

R. Haralick, L. Shapiro β€œComputer and Robot Vision” Addison-Wesley, 1992, pp. 61

ModuleπŸ”—

Foundation