Start » Filter Reference » OpenCV » Miscellaneous Image Transformations » cvGrabCut

cvGrabCut


Module: OpenCV

Runs the GrabCut algorithm.

Name Type Description
Input value
inImage Image UINT8, 3-channel input image.
Input value
inForeground Region Obvious foreground region.
Input value
inBackground Region Obvious background region.
Input value
inPBackground Region Possible background region.
Input value
inRect Box* Box containing segmented object.
Input value
inIterCount Integer Number of iterations the algorithm should make before returning the result.
Input value
inMode CvGrabCutMode Mode of GrabCut.
Output value
outBackground Region Output region of obvious background.
Output value
outForeground Region Output region of obvious foreground.
Output value
outPBackground Region Output region of possible background.
Output value
outPForeground Region Output region of possible foreground.

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError Foreground and Background regions must not be empty in cvGrabCut.
DomainError Input image must be 3-channel, UINT8 in cvGrabCut.
DomainError Input image must not be empty in cvGrabCut.
DomainError Input rectangle must be set in GC_INIT_WITH_RECT.

Complexity Level

This filter is available on Basic Complexity Level.