MatGrabCut Method OpenCvSharp Class Library
Segments the image using GrabCut algorithm. The input is 8-bit 3-channel image.

Namespace:  OpenCvSharp.CPlusPlus
Assembly:  OpenCvSharp.CPlusPlus (in OpenCvSharp.CPlusPlus.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax

public void GrabCut(
	InputOutputArray mask,
	Rect rect,
	InputOutputArray bgdModel,
	InputOutputArray fgdModel,
	int iterCount,
	GrabCutFlag mode
)

Parameters

mask
Type: OpenCvSharp.CPlusPlusInputOutputArray
Input/output 8-bit single-channel mask. The mask is initialized by the function when mode is set to GC_INIT_WITH_RECT. Its elements may have Cv2.GC_BGD / Cv2.GC_FGD / Cv2.GC_PR_BGD / Cv2.GC_PR_FGD
rect
Type: OpenCvSharp.CPlusPlusRect
ROI containing a segmented object. The pixels outside of the ROI are marked as "obvious background". The parameter is only used when mode==GC_INIT_WITH_RECT.
bgdModel
Type: OpenCvSharp.CPlusPlusInputOutputArray
Temporary array for the background model. Do not modify it while you are processing the same image.
fgdModel
Type: OpenCvSharp.CPlusPlusInputOutputArray
Temporary arrays for the foreground model. Do not modify it while you are processing the same image.
iterCount
Type: SystemInt32
Number of iterations the algorithm should make before returning the result. Note that the result can be refined with further calls with mode==GC_INIT_WITH_MASK or mode==GC_EVAL .
mode
Type: OpenCvSharp.CPlusPlusGrabCutFlag
Operation mode that could be one of GrabCutFlag value.
See Also

Reference