http://www.emgu.com
The grab cut algorithm for segmentation

Namespace: Emgu.CV
Assembly: Emgu.CV (in Emgu.CV.dll) Version: 2.4.2.1777 (2.4.2.1777)

Syntax

C#
public static void CvGrabCut(
	IntPtr img,
	IntPtr mask,
	ref Rectangle rect,
	IntPtr bgdModel,
	IntPtr fgdModel,
	int iterCount,
	GRABCUT_INIT_TYPE type
)
Visual Basic
Public Shared Sub CvGrabCut ( _
	img As IntPtr, _
	mask As IntPtr, _
	ByRef rect As Rectangle, _
	bgdModel As IntPtr, _
	fgdModel As IntPtr, _
	iterCount As Integer, _
	type As GRABCUT_INIT_TYPE _
)
Visual C++
public:
static void CvGrabCut(
	IntPtr img, 
	IntPtr mask, 
	Rectangle% rect, 
	IntPtr bgdModel, 
	IntPtr fgdModel, 
	int iterCount, 
	GRABCUT_INIT_TYPE type
)

Parameters

img
Type: System..::..IntPtr
The 8-bit 3-channel image to be segmented
mask
Type: System..::..IntPtr
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 one of following values: 0 (GC_BGD) defines an obvious background pixels. 1 (GC_FGD) defines an obvious foreground (object) pixel. 2 (GC_PR_BGR) defines a possible background pixel. 3 (GC_PR_FGD) defines a possible foreground pixel.
rect
Type: System.Drawing..::..Rectangle%
The rectangle to initialize the segmentation
bgdModel
Type: System..::..IntPtr
Temporary array for the background model. Do not modify it while you are processing the same image.
fgdModel
Type: System..::..IntPtr
Temporary arrays for the foreground model. Do not modify it while you are processing the same image.
iterCount
Type: System..::..Int32
The number of iternations
type
Type: Emgu.CV.CvEnum..::..GRABCUT_INIT_TYPE
The initilization type

See Also