Darwin  1.10(beta)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
drwnGrabCutInstanceHistogram Class Reference
Inheritance diagram for drwnGrabCutInstanceHistogram:
drwnGrabCutInstance

Public Member Functions

 drwnGrabCutInstanceHistogram ()
 default constructor
 
virtual ~drwnGrabCutInstanceHistogram ()
 destructor
 
void loadColourModels (const char *filename)
 load colour models
 
void saveColourModels (const char *filename) const
 save colour models
 
- Public Member Functions inherited from drwnGrabCutInstance
 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
 
void setBaseModelWeights (double u, double p, double c)
 sets unary and pairwise weights
 
const cv::Mat & unaryPotentials () const
 get unary potentials
 
const drwnPixelNeighbourContrastspairwisePotentials ()
 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
 

Static Public Attributes

static double pseudoCounts = 1.0
 pseudocounts in colour histogram model
 
static unsigned channelBits = 3
 number of bits per RGB colour channel
 
- Static Public Attributes inherited from drwnGrabCutInstance
static const unsigned char MASK_FG = 0xff
 foreground mask
 
static const unsigned char MASK_BG = 0x00
 background mask
 
static const unsigned char MASK_C_FG = 0x80
 foreground colour mask
 
static const unsigned char MASK_C_BG = 0x40
 background colour mask
 
static const unsigned char MASK_C_BOTH = 0xc0
 both colour mask
 
static const unsigned char MASK_C_NONE = 0x20
 neither colour mask
 
static bool bVisualize = false
 visualize output
 
static int maxIterations = 10
 maximum number of inference iterations
 

Protected Member Functions

void learnColourModel (const cv::Mat &mask, bool bForeground)
 learn a gaussian mixture model for pixels in masked region
 
void updateUnaryPotentials ()
 update unary potential from colour models
 
- Protected Member Functions inherited from drwnGrabCutInstance
void free ()
 free all memory
 
vector< double > pixelColour (int y, int x) const
 extract pixel colour as a 3-vector
 
virtual cv::Mat graphCut (const cv::Mat &unary) const
 graph-cut inference
 

Protected Attributes

drwnColourHistogram _fgColourModel
 foreground colour model
 
drwnColourHistogram _bgColourModel
 background colour model
 
- Protected Attributes inherited from drwnGrabCutInstance
cv::Mat _img
 the image
 
cv::Mat _trueMask
 ground-truth segmentation (trimap)
 
cv::Mat _mask
 segmentation mask (quadmap)
 
int _numUnknown
 number of unknown pixels in _mask
 
cv::Mat _unary
 unary potentials, (y_i == background)
 
drwnPixelNeighbourContrasts_pairwise
 pairwise potentials
 
double _unaryWeight
 weight for unary term in grabCut model
 
double _pottsWeight
 weight for potts smoothness term
 
double _pairwiseWeight
 weight for contrast-sensitive pairwise term
 

Additional Inherited Members

- Public Attributes inherited from drwnGrabCutInstance
string name
 instance name (if available)
 

The documentation for this class was generated from the following files: