| Cv2GrabCut Method |
Segments the image using GrabCut algorithm
Namespace:
OpenCvSharp
Assembly:
OpenCvSharp (in OpenCvSharp.dll) Version: 1.0.0
Syntax public static void GrabCut(
InputArray img,
InputOutputArray mask,
Rect rect,
InputOutputArray bgdModel,
InputOutputArray fgdModel,
int iterCount,
GrabCutModes mode
)
Public Shared Sub GrabCut (
img As InputArray,
mask As InputOutputArray,
rect As Rect,
bgdModel As InputOutputArray,
fgdModel As InputOutputArray,
iterCount As Integer,
mode As GrabCutModes
)
public:
static void GrabCut(
InputArray^ img,
InputOutputArray^ mask,
Rect rect,
InputOutputArray^ bgdModel,
InputOutputArray^ fgdModel,
int iterCount,
GrabCutModes mode
)
static member GrabCut :
img : InputArray *
mask : InputOutputArray *
rect : Rect *
bgdModel : InputOutputArray *
fgdModel : InputOutputArray *
iterCount : int *
mode : GrabCutModes -> unit
Parameters
- img
- Type: OpenCvSharpInputArray
Input 8-bit 3-channel image. - 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