Skip to content

union_cocircular_contours_xldunion_cocircular_contours_xldUnionCocircularContoursXldUnionCocircularContoursXldunion_cocircular_contours_xldunion_cocircular_contours_xld🔗

Short description🔗

union_cocircular_contours_xldunion_cocircular_contours_xldUnionCocircularContoursXldUnionCocircularContoursXldunion_cocircular_contours_xldunion_cocircular_contours_xld — Compute the union of contours that belong to the same circle.

Signature🔗

union_cocircular_contours_xld( xld_cont Contours, out xld_cont UnionContours, angle.rad MaxArcAngleDiff, angle.rad MaxArcOverlap, angle.rad MaxTangentAngle, number MaxDist, number MaxRadiusDiff, number MaxCenterDist, string MergeSmallContours, integer Iterations )union_cocircular_contours_xld( Contours : UnionContours : MaxArcAngleDiff, MaxArcOverlap, MaxTangentAngle, MaxDist, MaxRadiusDiff, MaxCenterDist, MergeSmallContours, Iterations : )void UnionCocircularContoursXld( const HObject& Contours, HObject* UnionContours, const HTuple& MaxArcAngleDiff, const HTuple& MaxArcOverlap, const HTuple& MaxTangentAngle, const HTuple& MaxDist, const HTuple& MaxRadiusDiff, const HTuple& MaxCenterDist, const HTuple& MergeSmallContours, const HTuple& Iterations )static void HOperatorSet.UnionCocircularContoursXld( HObject contours, out HObject unionContours, HTuple maxArcAngleDiff, HTuple maxArcOverlap, HTuple maxTangentAngle, HTuple maxDist, HTuple maxRadiusDiff, HTuple maxCenterDist, HTuple mergeSmallContours, HTuple iterations )def union_cocircular_contours_xld( contours: HObject, max_arc_angle_diff: Union[int, float], max_arc_overlap: Union[int, float], max_tangent_angle: Union[int, float], max_dist: Union[int, float], max_radius_diff: Union[int, float], max_center_dist: Union[int, float], merge_small_contours: str, iterations: int ) -> HObject

Herror union_cocircular_contours_xld( const Hobject Contours, Hobject* UnionContours, double MaxArcAngleDiff, double MaxArcOverlap, double MaxTangentAngle, double MaxDist, double MaxRadiusDiff, double MaxCenterDist, const char* MergeSmallContours, const Hlong Iterations )

Herror T_union_cocircular_contours_xld( const Hobject Contours, Hobject* UnionContours, const Htuple MaxArcAngleDiff, const Htuple MaxArcOverlap, const Htuple MaxTangentAngle, const Htuple MaxDist, const Htuple MaxRadiusDiff, const Htuple MaxCenterDist, const Htuple MergeSmallContours, const Htuple Iterations )

HXLDCont HXLDCont::UnionCocircularContoursXld( const HTuple& MaxArcAngleDiff, const HTuple& MaxArcOverlap, const HTuple& MaxTangentAngle, const HTuple& MaxDist, const HTuple& MaxRadiusDiff, const HTuple& MaxCenterDist, const HString& MergeSmallContours, Hlong Iterations ) const

HXLDCont HXLDCont::UnionCocircularContoursXld( double MaxArcAngleDiff, double MaxArcOverlap, double MaxTangentAngle, double MaxDist, double MaxRadiusDiff, double MaxCenterDist, const HString& MergeSmallContours, Hlong Iterations ) const

HXLDCont HXLDCont::UnionCocircularContoursXld( double MaxArcAngleDiff, double MaxArcOverlap, double MaxTangentAngle, double MaxDist, double MaxRadiusDiff, double MaxCenterDist, const char* MergeSmallContours, Hlong Iterations ) const

HXLDCont HXLDCont::UnionCocircularContoursXld( double MaxArcAngleDiff, double MaxArcOverlap, double MaxTangentAngle, double MaxDist, double MaxRadiusDiff, double MaxCenterDist, const wchar_t* MergeSmallContours, Hlong Iterations ) const (Windows only)

HXLDCont HXLDCont.UnionCocircularContoursXld( HTuple maxArcAngleDiff, HTuple maxArcOverlap, HTuple maxTangentAngle, HTuple maxDist, HTuple maxRadiusDiff, HTuple maxCenterDist, string mergeSmallContours, int iterations )

HXLDCont HXLDCont.UnionCocircularContoursXld( double maxArcAngleDiff, double maxArcOverlap, double maxTangentAngle, double maxDist, double maxRadiusDiff, double maxCenterDist, string mergeSmallContours, int iterations )

Description🔗

The operator union_cocircular_contours_xldUnionCocircularContoursXld merges all contours that belong to the same circle. The result is a set of contours in which contours on the same circle are connected.

The algorithm tries to merge contours by first fitting circles to each contour and then examining the result by means of radius, circle center, and gap on the circular arc. The list of contours is processed in sequence of increasing radii. Contours to which no circle could be fitted are optionally merged in a second pass.

The threshold parameters are used to define whether contours belong to the same circle. All thresholds must be fulfilled simultaneously for two contours to be merged.

Parameters

For each possible merge of two contours a cost is calculated by summing up the distances corresponding to the different threshold values. For comparability, the distances are scaled by the thresholds to a value between \(0.0\) and \(1.0\). If two or more contour start points match to the same end point of another contour, the contour with the lower cost is merged.

You should make sure that the input contours can be approximated by lines and circular arcs, for example by preprocessing them with split_contours_xldSplitContoursXld.

Attention🔗

Note that already closed contours are not considered for a union anymore. That is, even if a contour and the already closed contour share the same circle, they are returned as separate contours.

Execution information🔗

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

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

  • Processed without parallelization.

Parameters🔗

Contourscontourscontours (input_object) xld_cont-array → objectobjectHObjectHXLDContHObjectHobject

Contours to be merged.

UnionContoursunionContoursunion_contours (output_object) xld_cont-array → objectobjectHObjectHXLDContHObjectHobject *

Merged contours.

MaxArcAngleDiffmaxArcAngleDiffmax_arc_angle_diff (input_control) angle.rad → (real / integer)(real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)

Maximum angular distance of two circular arcs.

Default: 0.50.5
Suggested values: 0.25, 0.5, 0.75, 1.00.25, 0.5, 0.75, 1.0

MaxArcOverlapmaxArcOverlapmax_arc_overlap (input_control) angle.rad → (real / integer)(real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)

Maximum overlap of two circular arcs.

Default: 0.10.1
Suggested values: 0.0, 0.1, 0.20.0, 0.1, 0.2

MaxTangentAnglemaxTangentAnglemax_tangent_angle (input_control) angle.rad → (real / integer)(real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)

Maximum angle between the connecting line and the tangents of circular arcs.

Default: 0.20.2
Suggested values: 0.1, 0.2, 0.3, 0.4, 0.50.1, 0.2, 0.3, 0.4, 0.5

MaxDistmaxDistmax_dist (input_control) number → (real / integer)(real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)

Maximum length of the gap between two circular arcs in pixels.

Default: 3030
Suggested values: 10, 30, 50, 7010, 30, 50, 70

MaxRadiusDiffmaxRadiusDiffmax_radius_diff (input_control) number → (real / integer)(real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)

Maximum radius difference of the circles fitted to two arcs.

Default: 1010
Suggested values: 10, 20, 3010, 20, 30

MaxCenterDistmaxCenterDistmax_center_dist (input_control) number → (real / integer)(real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)

Maximum center distance of the circles fitted to two arcs.

Default: 1010
Suggested values: 10, 20, 3010, 20, 30

MergeSmallContoursmergeSmallContoursmerge_small_contours (input_control) string → (string)(string)HTuple (HString)HTuple (string)strHtuple (char*)

Determine whether small contours without fitted circles should also be merged.

Default: 'true'"true"
List of values: 'false', 'true'"false", "true"

Iterationsiterationsiterations (input_control) integer → (integer)(integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Number of iterations.

Default: 11
Suggested values: 1, 21, 2

Complexity🔗

\(O(n^2)\) for \(n\) contours.

Result🔗

union_cocircular_contours_xldUnionCocircularContoursXld returns 2 (H_MSG_TRUE) if all parameters are correct.

Combinations with other operators🔗

Combinations

Possible predecessors

split_contours_xldSplitContoursXld, select_contours_xldSelectContoursXld

Alternatives

union_collinear_contours_xldUnionCollinearContoursXld, union_cotangential_contours_xldUnionCotangentialContoursXld, union_straight_contours_xldUnionStraightContoursXld, union_adjacent_contours_xldUnionAdjacentContoursXld, union_collinear_contours_ext_xldUnionCollinearContoursExtXld

Module🔗

Foundation