approxPolyDP function

List<Point> approxPolyDP(
  1. List<Point> curve,
  2. double epsilon,
  3. bool closed
)

ApproxPolyDP approximates a polygonal curve(s) with the specified precision.

For further details, please see:

https:///docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#ga0012a5fdaea70b8a9970165d98722b4c

Implementation

List<Point> approxPolyDP(List<Point> curve, double epsilon, bool closed) {
  final pointVec = curve.toNativeVecotr();
  final vec = _bindings.ApproxPolyDP(pointVec, epsilon, closed);
  _bindings.PointVector_Close(pointVec);
  return List.generate(
    _bindings.PointVector_Size(vec),
    (index) => Point.fromNative(_bindings.PointVector_At(vec, index)),
  );
}