Darwin
1.10(beta)
|
Convenience class for holding pixel contrast weights. More...
Public Member Functions | |
drwnPixelNeighbourContrasts () | |
default constructor | |
drwnPixelNeighbourContrasts (const cv::Mat &img) | |
construct and cache pixel contrast weights for the given image | |
const char * | type () const |
returns object type as a string (e.g., Foo::type() { return "Foo"; }) | |
drwnPixelNeighbourContrasts * | clone () const |
returns a copy of the class usually implemented as virtual Foo* clone() { return new Foo(*this); } | |
virtual void | clear () |
clear all cached contrast weights | |
virtual void | initialize (const cv::Mat &img) |
cache contrast weights for the given image | |
bool | save (drwnXMLNode &xml) const |
write object to XML node (see also write) | |
bool | load (drwnXMLNode &xml) |
read object from XML node (see also read) | |
int | width () const |
width of the image (in pixels) | |
int | height () const |
height of the image (in pixels) | |
double | contrastN (int x, int y) const |
return the contrast weight between pixels (x,y) and (x,y-1) | |
double | contrastS (int x, int y) const |
return the contrast weight between pixels (x,y) and (x,y+1) | |
double | contrastE (int x, int y) const |
return the contrast weight between pixels (x,y) and (x+1,y) | |
double | contrastW (int x, int y) const |
return the contrast weight between pixels (x,y) and (x-1,y) | |
double | contrastNW (int x, int y) const |
return the contrast weight between pixels (x,y) and (x-1,y-1) | |
double | contrastSW (int x, int y) const |
return the contrast weight between pixels (x,y) and (x-1,y+1) | |
double | contrastNE (int x, int y) const |
return the contrast weight between pixels (x,y) and (x+1,y-1) | |
double | contrastSE (int x, int y) const |
return the contrast weight between pixels (x,y) and (x+1,y+1) | |
cv::Mat | visualize (bool bComposite=true) const |
Visualize the strength of the contrast term. If bComposite is false then the contrast is visualized in each direction separately. | |
![]() | |
bool | write (const char *filename) const |
write object to file (calls save) | |
bool | read (const char *filename) |
read object from file (calls load) | |
void | dump () const |
print object's current state to standard output (for debugging) | |
Static Protected Member Functions | |
static double | pixelContrast (const cv::Mat &img, const cv::Point &p, const cv::Point &q) |
Protected Attributes | |
MatrixXd | _horzContrast |
contrast between (x, y) and (x - 1, y) | |
MatrixXd | _vertContrast |
contrast between (x, y) and (x, y - 1) | |
MatrixXd | _nwContrast |
(north-west) contrast between (x, y) and (x - 1, y - 1) | |
MatrixXd | _swContrast |
(south-west) contrast between (x, y) and (x - 1, y + 1) | |
Convenience class for holding pixel contrast weights.
These are used in various CRF image segmentation models (see drwnSegImageInstance) with pairwise neighbourhood penalties taking the form where
is the mean square-difference between neighbouring pixel colours and
is the distance between pixels p and q.