Darwin
1.10(beta)
|
Implementation of bounding-box-based figure-ground segmentation "grabCut" algorithm by Rother et al., SIGGRAPH 2004. The bounding box can be provided interactively by the user or supplied on the commandline.
Example:
The following screenshot shows example results from an original image (top left) and foreground mask (top right). The foreground mask was generated from user input. The final segmentation mask (bottom left) and segmented image (bottom right) are also shown.
Higher-order potentials can be added to grabCut to improve the segmentation quality especially when the foreground object is occluded. Here we use k-means to define the higher-order cliques and a robust Potts model to enfore consistency.
Example:
The following screenshot shows exmaple results using higher-order consistency.
Instead of the user having to provide a mask interactively the grabCut
and highOrderGrabCut
applications allow a mask to be provided on the commandline. The mask should be a grayscale image the same size as the original image. The value for each pixel then determines how the pixel will be treated by the GrabCut algorithm as follows:
0x00
: definitely background (used to estimate background colour model) 0x40
: probably background (used to estimate background colour model but can be labeled as foreground in final segmentation) 0x80
: probably foreground (used to estimate foreground colour model but can be labeled as background in final segmentation) 0xff
: definitely foreground (used to estimate foreground colour model) 0xc0
: either foreground or background (used to estimate both colour models and can be labeled as either foreground or background in final segmentation) 0x20
: neither foreground nor background (not used for estimating colour models but will be labeled as one of foreground or background in final segmentation)