Click or drag to resize

MatGrabCut Method

Segments the image using GrabCut algorithm. The input is 8-bit 3-channel image.

Namespace:  OpenCvSharp
Assembly:  OpenCvSharp (in OpenCvSharp.dll) Version: 1.0.0
Syntax
public void GrabCut(
	InputOutputArray mask,
	Rect rect,
	InputOutputArray bgdModel,
	InputOutputArray fgdModel,
	int iterCount,
	GrabCutModes mode
)

Parameters

mask
Type: OpenCvSharpInputOutputArray
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: OpenCvSharpRect
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: OpenCvSharpInputOutputArray
Temporary array for the background model. Do not modify it while you are processing the same image.
fgdModel
Type: OpenCvSharpInputOutputArray
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: OpenCvSharpGrabCutModes
Operation mode that could be one of GrabCutFlag value.
See Also