Approximate XLD contours by polygons.
poly_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 to 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 maximum. 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.
Contours (input_object) |
xld_cont-array -> object |
Contours to be approximated. |
Polygons (output_object) |
xld_poly-array -> object |
Approximating polygons. |
Type (input_control) |
string -> string |
Type of approximation. | |
Default value: 'ramer' | |
List of values: 'ramer', 'ray', 'sato' |
Alpha (input_control) |
number -> real / integer |
Threshold for the approximation. | |
Default value: 2.0 | |
Suggested values: 1.0, 1.5, 2.0, 3.0, 4.0 | |
Restriction: Alpha > 0.0 |
gen_contour_xld, gen_contour2_xld, lines_gauss, lines_facet, edges_sub_pix