http://www.emgu.com
Use grabcut to perform background foreground segmentation.

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

Syntax

C#
public Image<Gray, byte> GrabCut(
	Rectangle rect,
	int iteration
)
Visual Basic
Public Function GrabCut ( 
	rect As Rectangle,
	iteration As Integer
) As Image(Of Gray, Byte)
Visual C++
public:
Image<Gray, unsigned char>^ GrabCut(
	Rectangle rect, 
	int iteration
)
F#
member GrabCut : 
        rect : Rectangle * 
        iteration : int -> Image<Gray, byte> 

Parameters

rect
Type: System.Drawing..::..Rectangle
The initial rectangle region for the foreground
iteration
Type: System..::..Int32
The number of iterations to run GrabCut

Return Value

Type: Image<(Of <(<'Gray, Byte>)>)>
The background foreground mask where 2 indicates background and 3 indicates foreground

See Also