Skip to content

intersection_closed_contours_xldIntersectionClosedContoursXldIntersectionClosedContoursXldintersection_closed_contours_xldintersection_closed_contours_xldπŸ”—

Short descriptionπŸ”—

intersection_closed_contours_xldIntersectionClosedContoursXldIntersectionClosedContoursXldintersection_closed_contours_xldintersection_closed_contours_xld β€” Intersect closed contours.

SignatureπŸ”—

intersection_closed_contours_xld( xld_cont Contours1, xld_cont Contours2, out xld_cont ContoursIntersection )void IntersectionClosedContoursXld( const HObject& Contours1, const HObject& Contours2, HObject* ContoursIntersection )static void HOperatorSet.IntersectionClosedContoursXld( HObject contours1, HObject contours2, out HObject contoursIntersection )def intersection_closed_contours_xld( contours_1: HObject, contours_2: HObject ) -> HObject

Herror intersection_closed_contours_xld( const Hobject Contours1, const Hobject Contours2, Hobject* ContoursIntersection )

Herror T_intersection_closed_contours_xld( const Hobject Contours1, const Hobject Contours2, Hobject* ContoursIntersection )

HXLDCont HXLDCont::IntersectionClosedContoursXld( const HXLDCont& Contours2 ) const

HXLDCont HXLDCont.IntersectionClosedContoursXld( HXLDCont contours2 )

DescriptionπŸ”—

The operator intersection_closed_contours_xldIntersectionClosedContoursXld calculates the intersection of the regions enclosed by the contours Contours1contours1contours_1 and Contours2contours2contours_2. The boundaries of this intersection are returned in ContoursIntersectioncontoursIntersectioncontours_intersection.

If the individual input contours are not closed, they are closed automatically by connecting their start and end points.

Internally, first, the regions enclosed by each set of contours (Contours1contours1contours_1 and Contours2contours2contours_2, respectively) are determined as described below. Then, the intersection of these two regions is calculated.

In the following, the two sets of input contours are referred to as boundary sets. A boundary set consists of an arbitrary number of boundaries (the individual contours of Contours1contours1contours_1 and Contours2contours2contours_2, respectively). Each boundary may be convex or concave and self-intersecting. Internal holes may be formed by the nesting of boundaries.

The region enclosed by such a boundary set is defined by the so-called Even-Odd-Rule. Thus, it consists of all points with the following property: The line constructed by connecting the point with another reference point that lies outside of the region has an odd number of intersections with boundaries.

More descriptive, this means that a boundary defines a hole in the region enclosed by another boundary if it lies completely inside that region. Similarly, the overlapping area of two separate boundaries of one boundary set is taken as a β€œhole”, i.e., it does not belong to the region enclosed by the two boundaries. Note that the region enclosed by a boundary does not depend on the orientation of the boundary.

A self-intersecting boundary may be split at the intersection point or it is reordered such that it touches itself at the intersection point. The resulting boundaries are treated as separate boundaries.

The resulting boundaries ContoursIntersectioncontoursIntersectioncontours_intersection are automatically classified into boundaries that enclose regions and boundaries that enclose holes. This information is stored in the global contour attribute 'is_hole'"is_hole". For further information about global contour attributes see get_contour_global_attrib_xldGetContourGlobalAttribXld.

Note that subsequent points whose row and column coordinates differ by less than 1e-06 pixels are considered as one point.

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πŸ”—

Contours1contours1contours_1 (input_object) xld_cont(-array) β†’ objectHObjectHXLDContHObjectHobject

Contours enclosing the first region to be intersected.

Contours2contours2contours_2 (input_object) xld_cont(-array) β†’ objectHObjectHXLDContHObjectHobject

Contours enclosing the second region to be intersected.

ContoursIntersectioncontoursIntersectioncontours_intersection (output_object) xld_cont(-array) β†’ objectHObjectHXLDContHObjectHobject *

Contours enclosing the intersection.

ResultπŸ”—

intersection_closed_contours_xldIntersectionClosedContoursXld returns 2 (H_MSG_TRUE) if all parameters are correct. If necessary, an exception is raised.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

gen_contour_region_xldGenContourRegionXld, zero_crossing_sub_pixZeroCrossingSubPix, threshold_sub_pixThresholdSubPix

Alternatives

intersectionIntersection

See also

difference_closed_contours_xldDifferenceClosedContoursXld, symm_difference_closed_contours_xldSymmDifferenceClosedContoursXld, union2_closed_contours_xldUnion2ClosedContoursXld, intersection_closed_polygons_xldIntersectionClosedPolygonsXld

ModuleπŸ”—

Foundation