Skip to content

approx_chain_simpleApproxChainSimpleApproxChainSimpleapprox_chain_simpleT_approx_chain_simple🔗

Short description🔗

approx_chain_simpleApproxChainSimpleApproxChainSimpleapprox_chain_simpleT_approx_chain_simple — Approximate a contour by arcs and lines.

Warning🔗

approx_chain_simpleApproxChainSimple is obsolete and is only provided for reasons of backward compatibility.

Signature🔗

approx_chain_simple( point.y Row, point.x Column, out arc.center.y ArcCenterRow, out arc.center.x ArcCenterCol, out arc.angle.rad ArcAngle, out arc.begin.y ArcBeginRow, out arc.begin.x ArcBeginCol, out line.begin.y LineBeginRow, out line.begin.x LineBeginCol, out line.end.y LineEndRow, out line.end.x LineEndCol, out integer Order )void ApproxChainSimple( const HTuple& Row, const HTuple& Column, HTuple* ArcCenterRow, HTuple* ArcCenterCol, HTuple* ArcAngle, HTuple* ArcBeginRow, HTuple* ArcBeginCol, HTuple* LineBeginRow, HTuple* LineBeginCol, HTuple* LineEndRow, HTuple* LineEndCol, HTuple* Order )static void HOperatorSet.ApproxChainSimple( HTuple row, HTuple column, out HTuple arcCenterRow, out HTuple arcCenterCol, out HTuple arcAngle, out HTuple arcBeginRow, out HTuple arcBeginCol, out HTuple lineBeginRow, out HTuple lineBeginCol, out HTuple lineEndRow, out HTuple lineEndCol, out HTuple order )def approx_chain_simple( row: Sequence[int], column: Sequence[int] ) -> Tuple[Sequence[int], Sequence[int], Sequence[float], Sequence[int], Sequence[int], Sequence[int], Sequence[int], Sequence[int], Sequence[int], Sequence[int]]

Herror T_approx_chain_simple( const Htuple Row, const Htuple Column, Htuple* ArcCenterRow, Htuple* ArcCenterCol, Htuple* ArcAngle, Htuple* ArcBeginRow, Htuple* ArcBeginCol, Htuple* LineBeginRow, Htuple* LineBeginCol, Htuple* LineEndRow, Htuple* LineEndCol, Htuple* Order )

static void HMisc::ApproxChainSimple( const HTuple& Row, const HTuple& Column, HTuple* ArcCenterRow, HTuple* ArcCenterCol, HTuple* ArcAngle, HTuple* ArcBeginRow, HTuple* ArcBeginCol, HTuple* LineBeginRow, HTuple* LineBeginCol, HTuple* LineEndRow, HTuple* LineEndCol, HTuple* Order )

static void HMisc.ApproxChainSimple( HTuple row, HTuple column, out HTuple arcCenterRow, out HTuple arcCenterCol, out HTuple arcAngle, out HTuple arcBeginRow, out HTuple arcBeginCol, out HTuple lineBeginRow, out HTuple lineBeginCol, out HTuple lineEndRow, out HTuple lineEndCol, out HTuple order )

Description🔗

The contour of a curve is approximated by a sequence of lines and arcs.

The result of the procedure is returned separately as arcs and lines. If one is interested in the sequence of the segments the individual resulting elements can be read successively from the resulting tuples. The sequence can be taken from the return parameter order (0: next element is next line segment, 1: next element is next arc segment).

The operator approx_chain_simpleApproxChainSimple behaves similarly as approx_chainApproxChain except that in the case of approx_chain_simpleApproxChainSimple the missing parameters are internally allocated as follows: MinWidthCoord = 1.0, MaxWidthCoord = 3.0, ThreshStart = 0.5, ThreshEnd = 0.9, ThreshStep = 0.3, MinWidthSmooth = 1.0, MaxWidthSmooth = 3.0, MinWidthCurve = 2, MaxWidthCurve = 9, Weight1 = 1.0, Weight2 = 1.0, Weight3 = 1.0.

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🔗

Rowrowrow (input_control) point.y-array → (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

Row of the contour.

Default: 3232

Columncolumncolumn (input_control) point.x-array → (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

Column of the contour.

Default: 3232

ArcCenterRowarcCenterRowarc_center_row (output_control) arc.center.y-array → (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

Row of the center of an arc.

ArcCenterColarcCenterColarc_center_col (output_control) arc.center.x-array → (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

Column of the center of an arc.

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

Angle of an arc.

ArcBeginRowarcBeginRowarc_begin_row (output_control) arc.begin.y-array → (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

Row of the starting point of an arc.

ArcBeginColarcBeginColarc_begin_col (output_control) arc.begin.x-array → (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

Column of the starting point of an arc.

LineBeginRowlineBeginRowline_begin_row (output_control) line.begin.y-array → (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

Row of the starting point of a line segment.

LineBeginCollineBeginColline_begin_col (output_control) line.begin.x-array → (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

Column of the starting point of a line segment.

LineEndRowlineEndRowline_end_row (output_control) line.end.y-array → (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

Row of the ending point of a line segment.

LineEndCollineEndColline_end_col (output_control) line.end.x-array → (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

Column of the ending point of a line segment.

Orderorderorder (output_control) integer-array → (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

Sequence of line (value 0) and arc segments (value 1).

Example🔗

(C)

/* read edge image */
read_image(&Image,"fig1_kan")\;
/* construct edge region */
hysteresis_threshold(Image,&RK1,64,255,40,1)\;
connection(RK1,&Rand)\;
/* fetch chain code */
T_get_region_contour(Rand,&Rows,&Columns)\;
firstline = get_i(Tline,0)\;
firstcol = get_i(Tcol,0)\;
/* approximation with lines and circular arcs */
T_approx_chain_simple(Rows,Columns,
                &Bzl,&Bzc,&Br,&Bwl,&Bwc,&Ll0,&Lc0,&Ll1,&Lc1,&order)\;
nob = length_tuple(Bzl)\;
nol = length_tuple(Ll0)\;
/* draw lines and arcs */
set_i(WindowHandleTuple,WindowHandle,0)\;
set_line_width(WindowHandle,4)\;
if (nob>0) T_disp_arc(Bzl,Bzc,Br,Bwl,Bwc)\;
set_line_width(WindowHandle,1)\;
if (nol>0) T_disp_line(WindowHandleTuple,Ll0,Lc0,Ll1,Lc1)\;

Result🔗

The operator approx_chain_simpleApproxChainSimple returns the value 2 (H_MSG_TRUE) if the parameters are correct. Otherwise an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

sobel_ampSobelAmp, edges_imageEdgesImage, get_region_contourGetRegionContour, thresholdThreshold, hysteresis_thresholdHysteresisThreshold

Possible successors

set_line_widthSetLineWidth, disp_arcDispArc, disp_lineDispLine

Alternatives

get_region_polygonGetRegionPolygon, approx_chainApproxChain

See also

get_region_chainGetRegionChain, smallest_circleSmallestCircle, disp_circleDispCircle, disp_lineDispLine

Module🔗

Foundation