ClassesClasses | | Operators

union_adjacent_contours_xldunion_adjacent_contours_xldUnionAdjacentContoursXldUnionAdjacentContoursXld (Operator)

Name

union_adjacent_contours_xldunion_adjacent_contours_xldUnionAdjacentContoursXldUnionAdjacentContoursXld — Compute the union of contours whose end points are close together.

Signature

union_adjacent_contours_xld(Contours : UnionContours : MaxDistAbs, MaxDistRel, Mode : )

Herror union_adjacent_contours_xld(const Hobject Contours, Hobject* UnionContours, double MaxDistAbs, double MaxDistRel, const char* Mode)

Herror T_union_adjacent_contours_xld(const Hobject Contours, Hobject* UnionContours, const Htuple MaxDistAbs, const Htuple MaxDistRel, const Htuple Mode)

void UnionAdjacentContoursXld(const HObject& Contours, HObject* UnionContours, const HTuple& MaxDistAbs, const HTuple& MaxDistRel, const HTuple& Mode)

HXLDCont HXLDCont::UnionAdjacentContoursXld(double MaxDistAbs, double MaxDistRel, const HString& Mode) const

HXLDCont HXLDCont::UnionAdjacentContoursXld(double MaxDistAbs, double MaxDistRel, const char* Mode) const

static void HOperatorSet.UnionAdjacentContoursXld(HObject contours, out HObject unionContours, HTuple maxDistAbs, HTuple maxDistRel, HTuple mode)

HXLDCont HXLDCont.UnionAdjacentContoursXld(double maxDistAbs, double maxDistRel, string mode)

Description

The operator union_adjacent_contours_xldunion_adjacent_contours_xldUnionAdjacentContoursXldUnionAdjacentContoursXldUnionAdjacentContoursXld unifies all contours of the input XLD contour array (ContoursContoursContoursContourscontours) whose end points are close together. The unified contour consists of the concatenation of the contour points of the input contours. If necessary, the order of these input contour points is flipped, so that the end points of the contours that have to be connected are direct neighbors in the resulting point list. This operation is repeated until there are no more unconnected adjacent contours left. As a result all the contours that are newly created by unification, as well as the input contours that could not be connected with any other contour, are returned in UnionContoursUnionContoursUnionContoursUnionContoursunionContours.

Parameters

The parameters MaxDistAbsMaxDistAbsMaxDistAbsMaxDistAbsmaxDistAbs and MaxDistRelMaxDistRelMaxDistRelMaxDistRelmaxDistRel are used to define the conditions for the proximity of two contours. In principle, the measures for these parameters depend on the order in which each pair of contours is evaluated, i.e., which contour is used as reference contour that is to be joined with the second contour. To avoid this dependency, the respective measures are evaluated in both directions and the order of contours is chosen that results in the smaller value for these measures. Note that in the illustrations below, the contour on the left is always used as the reference contour. The parameter ModeModeModeModemode controls the handling of the attributes of the input contours.

MaxDistAbsMaxDistAbsMaxDistAbsMaxDistAbsmaxDistAbs

The parameter MaxDistAbsMaxDistAbsMaxDistAbsMaxDistAbsmaxDistAbs defines the maximum accepted absolute distance between the two contours. The distance is measured along the regression line of the reference contour. Thus, it is the length of the projection of the gap between the two contours onto the regression line of the reference contour.

image/svg+xml a

MaxDistRelMaxDistRelMaxDistRelMaxDistRelmaxDistRel

The parameter MaxDistRelMaxDistRelMaxDistRelMaxDistRelmaxDistRel defines the maximum accepted relative distance between the two contours. The relative distance is calculated by dividing the distance a (see the description of the parameter MaxDistAbsMaxDistAbsMaxDistAbsMaxDistAbsmaxDistAbs) by the length b of the reference contour.

image/svg+xml a b

The order for connecting adjacent contours depends mainly on the distance of the neighbored end points: the contours with the smallest distance are connected first. If there are two pairs of contours with the same distance, first the contour pair that does not contain the shortest contour is connected.

ModeModeModeModemode

Finally, by the parameter ModeModeModeModemode it is possible to control how to handle the attributes that may come with input contours. For example, the operator edges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPixEdgesSubPix attaches to every contour point attributes like the local orientation, the edge response, and the edge direction. Choosing the default value 'attr_keep'"attr_keep""attr_keep""attr_keep""attr_keep", all attributes are copied to the output, and - if a contour has to be flipped for connecting it with another one - they are adapted to the new orientation. With a great number of input contours, however, it may be sensible to ignore the attributes for performance reasons, if they are not needed for further calculations. For this the value 'attr_forget'"attr_forget""attr_forget""attr_forget""attr_forget" has to be passed.

Execution Information

Parameters

ContoursContoursContoursContourscontours (input_object)  xld_cont-array objectHXLDContHXLDContHobject

Input XLD contours.

UnionContoursUnionContoursUnionContoursUnionContoursunionContours (output_object)  xld_cont-array objectHXLDContHXLDContHobject *

Output XLD contours.

MaxDistAbsMaxDistAbsMaxDistAbsMaxDistAbsmaxDistAbs (input_control)  real HTupleHTupleHtuple (real) (double) (double) (double)

Maximum distance of the contours' end points.

Default value: 10.0

Typical range of values: 0.0 ≤ MaxDistAbs MaxDistAbs MaxDistAbs MaxDistAbs maxDistAbs

MaxDistRelMaxDistRelMaxDistRelMaxDistRelmaxDistRel (input_control)  real HTupleHTupleHtuple (real) (double) (double) (double)

Maximum distance of the contours' end points in relation to the length of the longer contour.

Default value: 1.0

Typical range of values: 0.0 ≤ MaxDistRel MaxDistRel MaxDistRel MaxDistRel maxDistRel

ModeModeModeModemode (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Mode describing the treatment of the contours' attributes.

Default value: 'attr_keep' "attr_keep" "attr_keep" "attr_keep" "attr_keep"

List of values: 'attr_forget'"attr_forget""attr_forget""attr_forget""attr_forget", 'attr_keep'"attr_keep""attr_keep""attr_keep""attr_keep"

Possible Predecessors

split_contours_xldsplit_contours_xldSplitContoursXldSplitContoursXldSplitContoursXld, select_contours_xldselect_contours_xldSelectContoursXldSelectContoursXldSelectContoursXld

Alternatives

union_collinear_contours_xldunion_collinear_contours_xldUnionCollinearContoursXldUnionCollinearContoursXldUnionCollinearContoursXld, union_collinear_contours_ext_xldunion_collinear_contours_ext_xldUnionCollinearContoursExtXldUnionCollinearContoursExtXldUnionCollinearContoursExtXld, union_cocircular_contours_xldunion_cocircular_contours_xldUnionCocircularContoursXldUnionCocircularContoursXldUnionCocircularContoursXld, union_straight_contours_xldunion_straight_contours_xldUnionStraightContoursXldUnionStraightContoursXldUnionStraightContoursXld, union_cotangential_contours_xldunion_cotangential_contours_xldUnionCotangentialContoursXldUnionCotangentialContoursXldUnionCotangentialContoursXld

See also

edges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPixEdgesSubPix, threshold_sub_pixthreshold_sub_pixThresholdSubPixThresholdSubPixThresholdSubPix, gen_polygons_xldgen_polygons_xldGenPolygonsXldGenPolygonsXldGenPolygonsXld, split_contours_xldsplit_contours_xldSplitContoursXldSplitContoursXldSplitContoursXld, select_contours_xldselect_contours_xldSelectContoursXldSelectContoursXldSelectContoursXld, get_contour_xldget_contour_xldGetContourXldGetContourXldGetContourXld, get_contour_attrib_xldget_contour_attrib_xldGetContourAttribXldGetContourAttribXldGetContourAttribXld

Module

Foundation


ClassesClasses | | Operators