Herror ::gen_polygons_xld (
    Hobject Contours,
    Hobject *Polygons,
    const HTuple &Type,
    const HTuple &Alpha
)
HXLDPolyArray HXLDContArray::GenPolygonsXld (
    const HTuple &Type,
    const HTuple &Alpha
) const

Approximate XLD contours by polygons.

::gen_polygons_xld approximates XLD contours (Contours) by polygons. The type of the approximation can be set by Type. The threshold for the approximation is set via Alpha. The procedure is able to process open as well as closed contours. The resulting approximating XLD polygons are returned in Polygons.

Contours can be approximated by the algorithms of Ramer, Ray, and Sato. The algorithm of Ramer approximates contours such that the Euclidian distance of the approximating polygon to the contour is at most Alpha pixel units. The algorithm of Ray does not need a threshold, and hence Alpha is ignored. Here, the contour is approximated by maximizing the line length, while minimizing the sum of the distances of the line segment from the contour. The algorithm of Sato produces a polygon point at the point of the contour in which the distance to the end points of the contour is maximal. The total approximation error for each iteration is then given by (L - L')/L, where L is the Euclidian contour length, and L' is the length of the approximating polygon.


Parameters

Contours (input_object)
xld_cont-array -> Hobject: HXLDContArray
Contours to be approximated.

Polygons (output_object)
xld_poly-array -> Hobject * : HXLDPolyArray
Approximating polygons.

Type (input_control)
string -> HTuple.char *
Type of approximation.
Default value: 'ramer'
List of values: 'ramer', 'ray', 'sato'

Alpha (input_control)
number -> HTuple.double / long
Threshold for the approximation.
Default value: 2.0
Suggested values: 1.0, 1.5, 2.0, 3.0, 4.0
Restriction: Alpha > 0.0


Possible Predecessors

::gen_contours_skeleton_xld, ::lines_gauss, ::lines_facet, ::edges_sub_pix


Possible Successors

::gen_parallels_xld


See also

::get_region_polygon


Module

Sub-pixel operators



Copyright © 1996-2002 MVTec Software GmbH