grabCut function

(Mat, Mat, Mat) grabCut(
  1. InputArray img,
  2. InputOutputArray mask,
  3. Rect rect,
  4. InputOutputArray bgdModel,
  5. InputOutputArray fgdModel,
  6. int iterCount, {
  7. int mode = GC_EVAL,
})

Grabcut runs the GrabCut algorithm. The function implements the GrabCut image segmentation algorithm. For further details, please see: https:///docs.opencv.org/master/d3/d47/group__imgproc__segmentation.html#ga909c1dda50efcbeaa3ce126be862b37f

Implementation

(Mat mask, Mat bgdModel, Mat fgdModel) grabCut(
  InputArray img,
  InputOutputArray mask,
  Rect rect,
  InputOutputArray bgdModel,
  InputOutputArray fgdModel,
  int iterCount, {
  int mode = GC_EVAL,
}) {
  cvRun(
    () => cimgproc.cv_grabCut(
      img.ref,
      mask.ref,
      rect.ref,
      bgdModel.ref,
      fgdModel.ref,
      iterCount,
      mode,
      ffi.nullptr,
    ),
  );
  return (mask, bgdModel, fgdModel);
}