connectedComponentsAsync function

Future<int> connectedComponentsAsync(
  1. Mat image,
  2. OutputArray labels,
  3. int connectivity,
  4. int ltype,
  5. int ccltype,
)

ConnectedComponents computes the connected components labeled image of boolean image.

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

Implementation

Future<int> connectedComponentsAsync(
  Mat image,
  OutputArray labels,
  int connectivity,
  int ltype,
  int ccltype,
) {
  final p = calloc<ffi.Int>();
  return cvRunAsync0(
    (callback) => cimgproc.cv_connectedComponents(
      image.ref,
      labels.ref,
      connectivity,
      ltype,
      ccltype,
      p,
      callback,
    ),
    (c) {
      final rval = p.value;
      calloc.free(p);
      return c.complete(rval);
    },
  );
}