Contents

polygonApproximation(epsilon:)

Simplifies the contour to a polygon using a Ramer-Douglas-Peucker algorithm.

Declaration

func polygonApproximation(epsilon: Float) throws -> VNContour

Parameters

  • epsilon:

    This parameter defines the distance threshold the algorithm uses. It preserves points whose perpendicular distance to the line segment they are on is greater than epsilon, and removes all others.

Return Value

A simplified polygon contour from the points of the original contour.

See Also

Inspecting the Contour