connectedComponentsWithStatsAsync function

Future<int> connectedComponentsWithStatsAsync(
  1. Mat src,
  2. Mat labels,
  3. Mat stats,
  4. Mat centroids,
  5. int connectivity,
  6. int ltype,
  7. int ccltype,
)

ConnectedComponentsWithStats computes the connected components labeled image of boolean image and also produces a statistics output for each label.

For further details, please see: https:///docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#ga107a78bf7cd25dec05fb4dfc5c9e765f

Implementation

Future<int> connectedComponentsWithStatsAsync(
  Mat src,
  Mat labels,
  Mat stats,
  Mat centroids,
  int connectivity,
  int ltype,
  int ccltype,
) {
  final p = calloc<ffi.Int>();
  return cvRunAsync0(
    (callback) => cimgproc.cv_connectedComponents_1(
      src.ref,
      labels.ref,
      stats.ref,
      centroids.ref,
      connectivity,
      ltype,
      ccltype,
      p,
      callback,
    ),
    (c) {
      final rval = p.value;
      calloc.free(p);
      return c.complete(rval);
    },
  );
}