Skip to content

line_positionLinePositionLinePositionline_positionline_position🔗

Short description🔗

line_positionLinePositionLinePositionline_positionline_position — Calculate the center of gravity, length, and orientation of a line.

Signature🔗

line_position( line.begin.y RowBegin, line.begin.x ColBegin, line.end.y RowEnd, line.end.x ColEnd, out point.y RowCenter, out point.x ColCenter, out real Length, out angle.rad Phi )void LinePosition( const HTuple& RowBegin, const HTuple& ColBegin, const HTuple& RowEnd, const HTuple& ColEnd, HTuple* RowCenter, HTuple* ColCenter, HTuple* Length, HTuple* Phi )static void HOperatorSet.LinePosition( HTuple rowBegin, HTuple colBegin, HTuple rowEnd, HTuple colEnd, out HTuple rowCenter, out HTuple colCenter, out HTuple length, out HTuple phi )def line_position( row_begin: MaybeSequence[Union[int, float]], col_begin: MaybeSequence[Union[int, float]], row_end: MaybeSequence[Union[int, float]], col_end: MaybeSequence[Union[int, float]] ) -> Tuple[Sequence[float], Sequence[float], Sequence[float], Sequence[float]]

def line_position_s( row_begin: MaybeSequence[Union[int, float]], col_begin: MaybeSequence[Union[int, float]], row_end: MaybeSequence[Union[int, float]], col_end: MaybeSequence[Union[int, float]] ) -> Tuple[float, float, float, float]Herror line_position( double RowBegin, double ColBegin, double RowEnd, double ColEnd, double* RowCenter, double* ColCenter, double* Length, double* Phi )

Herror T_line_position( const Htuple RowBegin, const Htuple ColBegin, const Htuple RowEnd, const Htuple ColEnd, Htuple* RowCenter, Htuple* ColCenter, Htuple* Length, Htuple* Phi )

static void HMisc::LinePosition( const HTuple& RowBegin, const HTuple& ColBegin, const HTuple& RowEnd, const HTuple& ColEnd, HTuple* RowCenter, HTuple* ColCenter, HTuple* Length, HTuple* Phi )

static void HMisc::LinePosition( double RowBegin, double ColBegin, double RowEnd, double ColEnd, double* RowCenter, double* ColCenter, double* Length, double* Phi )

static void HMisc.LinePosition( HTuple rowBegin, HTuple colBegin, HTuple rowEnd, HTuple colEnd, out HTuple rowCenter, out HTuple colCenter, out HTuple length, out HTuple phi )

static void HMisc.LinePosition( double rowBegin, double colBegin, double rowEnd, double colEnd, out double rowCenter, out double colCenter, out double length, out double phi )

Description🔗

The operator line_positionLinePosition returns the center (RowCenterrowCenterrow_center, ColCentercolCentercol_center), the (Euclidean) length (Lengthlengthlength) and the orientation (\(-\pi/2 < \textrm{Phi} <= \pi/2\)) of the given lines. If more than one line is to be treated the line and column indices can be passed as tuples. In this case the output parameters, of course, are also tuples.

The routine is applied, for example, to model lines in order to determine search regions for the edge detection (detect_edge_segmentsDetectEdgeSegments).

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🔗

RowBeginrowBeginrow_begin (input_control) line.begin.y(-array) → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[int, float]]Htuple (double / Hlong)

Row coordinates of the starting points of the input lines.

ColBegincolBegincol_begin (input_control) line.begin.x(-array) → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[int, float]]Htuple (double / Hlong)

Column coordinates of the starting points of the input lines.

RowEndrowEndrow_end (input_control) line.end.y(-array) → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[int, float]]Htuple (double / Hlong)

Row coordinates of the ending points of the input lines.

ColEndcolEndcol_end (input_control) line.end.x(-array) → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[int, float]]Htuple (double / Hlong)

Column coordinates of the ending points of the input lines.

RowCenterrowCenterrow_center (output_control) point.y(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Row coordinates of the centers of gravity of the input lines.

ColCentercolCentercol_center (output_control) point.x(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Column coordinates of the centers of gravity of the input lines.

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

Euclidean length of the input lines.

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

Orientation of the input lines.

Result🔗

line_positionLinePosition always returns the value 2 (H_MSG_TRUE).

Combinations with other operators🔗

Combinations

Possible predecessors

sobel_ampSobelAmp, edges_imageEdgesImage, thresholdThreshold, hysteresis_thresholdHysteresisThreshold, split_skeleton_regionSplitSkeletonRegion, split_skeleton_linesSplitSkeletonLines

Possible successors

set_line_widthSetLineWidth, disp_lineDispLine

Alternatives

line_orientationLineOrientation

See also

line_orientationLineOrientation, detect_edge_segmentsDetectEdgeSegments

Module🔗

Foundation