Table of Contents

Method ApproxPolyN

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

ApproxPolyN(InputArray, OutputArray, int, float, bool)

Approximates a polygon with a convex hull with a specified accuracy and number of sides.

public static void ApproxPolyN(InputArray curve, OutputArray approxCurve, int nsides, float epsilonPercentage = -1, bool ensureConvex = true)

Parameters

curve InputArray

Input vector of a 2D points stored in std::vector or Mat, points must be float or integer.

approxCurve OutputArray

Result of the approximation. The type is vector of a 2D point (Point2f or Point) in std::vector or Mat.

nsides int

The parameter defines the number of sides of the result polygon.

epsilonPercentage float

Defines the percentage of the maximum of additional area. If it equals -1, it is not used. Otherwise the algorithm stops if the additional area is greater than contourArea(curve) * percentage. If the additional area exceeds the limit, the algorithm returns as many vertices as there were at the moment the limit was exceeded.

ensureConvex bool

If true, the algorithm creates a convex hull of the input contour. Otherwise the input vector should already be convex.