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
curveInputArrayInput vector of a 2D points stored in std::vector or Mat, points must be float or integer.
approxCurveOutputArrayResult of the approximation. The type is vector of a 2D point (Point2f or Point) in std::vector or Mat.
nsidesintThe parameter defines the number of sides of the result polygon.
epsilonPercentagefloatDefines 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.
ensureConvexboolIf true, the algorithm creates a convex hull of the input contour. Otherwise the input vector should already be convex.