Implements the grabCut algorithm of Rother et al., SIGGRAPH 2004 for figure/ground segmentation.
More...
|
| drwnGrabCutInstance () |
| default constructor
|
|
| drwnGrabCutInstance (const drwnGrabCutInstance &instance) |
| copy constructor
|
|
virtual | ~drwnGrabCutInstance () |
| destructor
|
|
int | width () const |
| width of the image
|
|
int | height () const |
| height of the image
|
|
int | size () const |
| number of pixels in the image
|
|
int | numUnknown () const |
| number of unknown pixels in the inference mask
|
|
const cv::Mat & | image () const |
| return the image
|
|
const cv::Mat & | trueSegmentation () const |
| return the mask for the true segmentation (if known)
|
|
const cv::Mat & | segmentationMask () const |
| return the mask for the inferred segmentation
|
|
cv::Mat | knownForeground () const |
| returns mask of all pixels not marked as MASK_FG (caller must free)
|
|
cv::Mat | knownBackground () const |
| returns mask of all pixels not marked as MASK_BG (caller must free)
|
|
cv::Mat | unknownPixels () const |
| returns mask of all pixels not marked as MASK_FG or MASK_BG (caller must free)
|
|
cv::Mat | foregroundColourMask () const |
| returns mask of all pixels marked as MASK_FG or MASK_FGC (caller must free)
|
|
cv::Mat | backgroundColourMask () const |
| returns mask of all pixels marked as MASK_BG or MASK_BGC (caller must free)
|
|
bool | isUnknownPixel (int x, int y, const cv::Mat &mask) const |
| returns true if the pixel at (x, y) is not foreground or background in mask
|
|
bool | isUnknownPixel (int x, int y) const |
| returns true if the pixel at (x, y) is not foreground or background in the initialized inference mask
|
|
void | initialize (const cv::Mat &img, const cv::Rect &rect, const char *colorModelFile=NULL) |
| initialize with image and bounding box region; ground-truth segmentation unknown uses colorModelFile to initialize colour models if given
|
|
void | initialize (const cv::Mat &img, const cv::Mat &inferMask, const char *colorModelFile=NULL) |
| initialize with image and mask of inference region; ground-truth segmentation unknown
|
|
void | initialize (const cv::Mat &img, const cv::Rect &rect, const cv::Mat &trueMask, const char *colorModelFile=NULL) |
| initialize with image and bounding box region
|
|
void | initialize (const cv::Mat &img, const cv::Mat &inferMask, const cv::Mat &trueMask, const char *colorModelFile=NULL) |
| initialize with image and mask of inference region
|
|
virtual void | loadColourModels (const char *filename)=0 |
| load colour models
|
|
virtual void | saveColourModels (const char *filename) const =0 |
| save colour models
|
|
void | setBaseModelWeights (double u, double p, double c) |
| sets unary and pairwise weights
|
|
const cv::Mat & | unaryPotentials () const |
| get unary potentials
|
|
const drwnPixelNeighbourContrasts * | pairwisePotentials () |
| get pairwise potentials
|
|
double | unaryEnergy (const cv::Mat &seg) const |
| compute energy contribution from the unary term
|
|
double | pottsEnergy (const cv::Mat &seg) const |
| compute energy contribution from the potts pairwise term
|
|
double | pairwiseEnergy (const cv::Mat &seg) const |
| compute energy contribution from the contrast-sensitive pairwise term
|
|
virtual double | energy (const cv::Mat &seg) const |
| compute the energy of a given segmentation
|
|
double | foregroundRatio (const cv::Mat &seg) const |
| compute the percentage of unknown pixels labeled as foreground
|
|
double | backgroundRatio (const cv::Mat &seg) const |
| compute the percentage of unknown pixels labeled as background
|
|
double | loss (const cv::Mat &seg) const |
| computes the loss between ground-truth and given segmentation
|
|
virtual cv::Mat | inference () |
| inference
|
|
virtual cv::Mat | lossAugmentedInference () |
| loss augmented inference (using ground-truth segmentation)
|
|
virtual cv::Mat | visualize (const cv::Mat &seg) const |
| visualization
|
|
Implements the grabCut algorithm of Rother et al., SIGGRAPH 2004 for figure/ground segmentation.
All images are assumed to be 3-channel, 8-bit. All masks are assumed to be 8-bit unsigned (single channel) with values: 0 to mean background, 64 unknown (initialize as background), 128 unknown (initialize as foreground), 255 foreground. Other values are treated as unknown but not used to learn colour models.
When learning foreground colour models pixels marked as MASK_FG, MASK_C_FG and MASK_C_BOTH are used. Likewise for background colour models (MASK_BG, MASK_C_BG and MASK_C_BOTH). During inference pixels marked as MASK_FG or MASK_BG are forced to take foreground or background labels, respectively.
- See Also
- grabCut Application