Skip to content

orientation_points_xldOrientationPointsXldOrientationPointsXldorientation_points_xldorientation_points_xld🔗

Short description🔗

orientation_points_xldOrientationPointsXldOrientationPointsXldorientation_points_xldorientation_points_xld — Calculate the orientation of contours or polygons treated as point clouds.

Signature🔗

orientation_points_xld( xld XLD, out angle.rad Phi )void OrientationPointsXld( const HObject& XLD, HTuple* Phi )static void HOperatorSet.OrientationPointsXld( HObject XLD, out HTuple phi )def orientation_points_xld( xld: HObject ) -> Sequence[float]

def orientation_points_xld_s( xld: HObject ) -> floatHerror orientation_points_xld( const Hobject XLD, double* Phi )

Herror T_orientation_points_xld( const Hobject XLD, Htuple* Phi )

HTuple HXLD::OrientationPointsXld( ) const

HTuple HXLD.OrientationPointsXld( )

Description🔗

The operator orientation_points_xldOrientationPointsXld calculates the orientation Phiphiphi of the point clouds given by the contours or polygons XLDXLDxld (the order of the points in the contour or polygon is not taken into account). The orientation Phiphiphi is calculated the same way as in elliptic_axis_points_xldEllipticAxisPointsXld. If the contour or polygon is closed (end point = start point), the end point of the contour or polygon is not taken into account to avoid that it receives twice the weight of the other points.

In addition, the contour point \(p_{m}\) with maximum distance to the center of gravity \(c\) is calculated. If the angle between the vector \(\overrightarrow{p_{m}c}\) and the vector given by Phiphiphi is greater than \(\pi\), the value of \(\pi\) is added to the angle. If XLDXLDxld consists of only two points, Phiphiphi is given by the direction from the first point towards the second point.

orientation_points_xldOrientationPointsXld should be used if the contour XLDXLDxld intersects itself or if it is not possible to close the contour using a line from end to start point without self-intersection, because in this case orientation_xldOrientationXld does not produce useful results. To test whether the contours or polygons intersect themselves, test_self_intersection_xldTestSelfIntersectionXld can be used.

If more than one contour or polygon is passed, the values of the orientations are stored in a tuple in the same order as the respective contours or polygons in XLDXLDxld.

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🔗

XLDXLDxld (input_object) xld(-array) → objectHObjectHXLDHObjectHobject

Contours or polygons to be examined.

Phiphiphi (output_control) angle.rad(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Orientation of the contours or polygons (radians).

Assertion: -pi < Phi && Phi <= pi

Combinations with other operators🔗

Combinations

Possible predecessors

gen_contours_skeleton_xldGenContoursSkeletonXld, edges_sub_pixEdgesSubPix, threshold_sub_pixThresholdSubPix, gen_contour_polygon_xldGenContourPolygonXld

Alternatives

orientation_xldOrientationXld, elliptic_axis_points_xldEllipticAxisPointsXld, smallest_rectangle2_xldSmallestRectangle2Xld

See also

moments_region_2ndMomentsRegion2nd

Module🔗

Foundation