Skip to content

get_contour_angle_xldGetContourAngleXldGetContourAngleXldget_contour_angle_xldT_get_contour_angle_xld🔗

Short description🔗

get_contour_angle_xldGetContourAngleXldGetContourAngleXldget_contour_angle_xldT_get_contour_angle_xld — Calculate the direction of an XLD contour for each contour point.

Signature🔗

get_contour_angle_xld( xld_cont Contour, string AngleMode, string CalcMode, integer Lookaround, out real Angles )void GetContourAngleXld( const HObject& Contour, const HTuple& AngleMode, const HTuple& CalcMode, const HTuple& Lookaround, HTuple* Angles )static void HOperatorSet.GetContourAngleXld( HObject contour, HTuple angleMode, HTuple calcMode, HTuple lookaround, out HTuple angles )def get_contour_angle_xld( contour: HObject, angle_mode: str, calc_mode: str, lookaround: int ) -> Sequence[float]

Herror T_get_contour_angle_xld( const Hobject Contour, const Htuple AngleMode, const Htuple CalcMode, const Htuple Lookaround, Htuple* Angles )

HTuple HXLDCont::GetContourAngleXld( const HString& AngleMode, const HString& CalcMode, Hlong Lookaround ) const

HTuple HXLDCont::GetContourAngleXld( const char* AngleMode, const char* CalcMode, Hlong Lookaround ) const

HTuple HXLDCont::GetContourAngleXld( const wchar_t* AngleMode, const wchar_t* CalcMode, Hlong Lookaround ) const (Windows only)

HTuple HXLDCont.GetContourAngleXld( string angleMode, string calcMode, int lookaround )

Description🔗

get_contour_angle_xldGetContourAngleXld calculates for each point of the XLD contour Contourcontourcontour the direction of its tangent. Two modes for the output values can be chosen: By passing 'abs'"abs" for AngleModeangleModeangle_mode, the resulting angles are returned relative to the horizontal axis as angles between 0 and \(2\pi\) (counter-clockwise). By passing 'rel'"rel", the angle difference to the previous contour point is returned. In this case the range of values is between \(-\pi\) and \(\pi\), where negative values indicate a right turn and positive values indicate a left turn.

There are three different ways of calculating the tangent direction (CalcModecalcModecalc_mode) of the contour point i using the contour points in the interval from \(i - \textrm{Lookaround}\) to \(i + \textrm{Lookaround}\). By using 'range'"range", the angle of the line segment between the first and last point of the interval is used. For 'mean'"mean", the average of all angles between consecutive points of the contour is used. Finally, for 'regress'"regress", the direction of the regression line (the least squares fit of a line to the contour points in the interval) is used. Lookaroundlookaroundlookaround is a measure of how strongly the contour is smoothed. The angles are returned in Anglesanglesangles in radians.

Due to the interval given by Lookaroundlookaroundlookaround, the input contour must have at least \(2 * \textrm{Lookaround} + 2\) points. This minimum number of points is required so that the operator always delivers reasonable output values for the different parameter settings.

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🔗

Contourcontourcontour (input_object) xld_cont → objectHObjectHXLDContHObjectHobject

Input contour.

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

Return type of the angles.

Default: 'abs'"abs"
List of values: 'abs', 'rel'"abs", "rel"

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

Method for computing the angles.

Default: 'range'"range"
List of values: 'mean', 'range', 'regress'"mean", "range", "regress"

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

Number of points to take into account.

Default: 33
Restriction: Lookaround > 0

Anglesanglesangles (output_control) real-array → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Direction of the tangent to the contour points.

Combinations with other operators🔗

Combinations

Possible predecessors

gen_contours_skeleton_xldGenContoursSkeletonXld, lines_gaussLinesGauss, lines_facetLinesFacet, edges_sub_pixEdgesSubPix

See also

get_contour_xldGetContourXld, get_contour_attrib_xldGetContourAttribXld

Module🔗

Foundation