connectedComponentsAsync function

Future<(int, Mat)> connectedComponentsAsync(
  1. Mat image,
  2. int connectivity,
  3. int ltype,
  4. 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 rval, Mat labels)> connectedComponentsAsync(
  Mat image,
  int connectivity,
  int ltype,
  int ccltype,
) async =>
    cvRunAsync2(
        (callback) => cffi.ConnectedComponents_Async(image.ref, connectivity, ltype, ccltype, callback),
        (completer, p, p1) {
      final rval = p.cast<ffi.Int>().value;
      calloc.free(p);
      completer.complete((rval, Mat.fromPointer(p1.cast<cvg.Mat>())));
    });