Direct Graphical Models
v.1.7.0
|
Potts Edge Model for dense graphical models. More...
#include <EdgeModelPotts.h>
Public Member Functions | |
CEdgeModelPotts (const Mat &features, float weight=1.0f, const std::function< void(const Mat &src, Mat &dst)> &semiMetricFunction={}, bool perPixelNormalization=true) | |
Constructor. More... | |
virtual | ~CEdgeModelPotts (void)=default |
void | apply (const Mat &src, Mat &dst) const override |
Applies an edge model to the node potentials of a dense graph. More... | |
Public Member Functions inherited from DirectGraphicalModels::IEdgeModel | |
IEdgeModel (void)=default | |
IEdgeModel (const IEdgeModel &)=delete | |
virtual | ~IEdgeModel (void)=default |
const IEdgeModel & | operator= (const IEdgeModel &)=delete |
Private Attributes | |
std::unique_ptr< CPermutohedral > | m_pLattice |
Pointer to the permutohedral lattice. More... | |
float | m_weight |
The weighting parameter. More... | |
Mat | m_norm |
Array with normalization factors. More... | |
std::function< void(const Mat &src, Mat &dst)> | m_function |
The semi-metric function. More... | |
Potts Edge Model for dense graphical models.
This class implements Potts edge potential model in the fully connected CRF. The implementation is based on Efficient Inference in Fully Connected CRFs with Gaussian Edge Potentials paper.
Definition at line 17 of file EdgeModelPotts.h.
DirectGraphicalModels::CEdgeModelPotts::CEdgeModelPotts | ( | const Mat & | features, |
float | weight = 1.0f , |
||
const std::function< void(const Mat &src, Mat &dst)> & | semiMetricFunction = {} , |
||
bool | perPixelNormalization = true |
||
) |
Constructor.
This constucts a new edge potentials model, which is in general training-data-independent, but still contrast-sensitive model (see PhD Thesis Multi-Layer Conditional Random Fields for Revealing Unobserved Entities p. 60 for more details). Test-data-dependency is provided via features argument. However this model might be ''trained'' by using a semimetric function provided via semiMetricFunction argument.
features | The set of features which correspond to the nodes of the dense graphical model: Mat(size: nNodes x nFeatures; type: CV_32FC1) |
weight | The weighting parameter (default value is 1) |
semiMetricFunction | Reference to a semi-metric function, which arguments src and dst are: Mat(size: 1 x nFeatures; type: CV_32FC1). This function when provided will be called for every node potential in the apply() method. |
perPixelNormalization | Flag indicating whether er-pixel normalization should be used during applying the edge model. |
Definition at line 5 of file EdgeModelPotts.cpp.
|
virtualdefault |
|
overridevirtual |
Applies an edge model to the node potentials of a dense graph.
This function subsequently (in terms of multiple iterations and multiple models) applies an edge model derived from this class to the node potentials provided via src argument and stores the result into the dst.
[in] | src | The dense graph node potentials in form Mat(size: nNodes x nStates; type: CV_32FC1) |
[out] | dst | The reference to the container for resulting node potentials. Resulting matrix will be the same size and type as the input one: Mat(size: nNodes x nStates; type: CV_32FC1) |
Implements DirectGraphicalModels::IEdgeModel.
Definition at line 28 of file EdgeModelPotts.cpp.
|
private |
The semi-metric function.
Definition at line 41 of file EdgeModelPotts.h.
|
private |
Array with normalization factors.
Definition at line 40 of file EdgeModelPotts.h.
|
private |
Pointer to the permutohedral lattice.
Definition at line 38 of file EdgeModelPotts.h.
|
private |
The weighting parameter.
Definition at line 39 of file EdgeModelPotts.h.