Direct Graphical Models
v.1.7.0
|
Extended Pairwise graph class for 2D image classifaction. More...
#include <GraphPairwiseExt.h>
Public Member Functions | |
CGraphPairwiseExt (IGraphPairwise &graph, byte gType=GRAPH_EDGES_GRID) | |
Constructor. More... | |
virtual | ~CGraphPairwiseExt (void)=default |
void | buildGraph (Size graphSize) override |
Builds a 2D graph of size corresponding to the image resolution. More... | |
void | setGraph (const Mat &pots) override |
Fills an existing 2D graph with potentials or builds a new 2D graph of size corresponding to pots.size() with potentials. More... | |
void | addDefaultEdgesModel (float val, float weight=1.0f) override |
Adds default data-independet edge model. More... | |
void | addDefaultEdgesModel (const Mat &featureVectors, float val, float weight=1.0f) override |
Adds default contrast-sensitive edge model. More... | |
void | addDefaultEdgesModel (const vec_mat_t &featureVectors, float val, float weight=1.0f) override |
Adds default contrast-sensitive edge model. More... | |
Size | getSize () const override |
Returns the size of the graph. More... | |
void | addFeatureVecs (CTrainEdge &edgeTrainer, const Mat &featureVectors, const Mat >) |
Adds a block of new feature vectors. More... | |
void | addFeatureVecs (CTrainEdge &edgeTrainer, const vec_mat_t &featureVectors, const Mat >) |
Adds a block of new feature vectors. More... | |
void | fillEdges (const CTrainEdge &edgeTrainer, const Mat &featureVectors, const vec_float_t &vParams, float weight=1.0f) |
Fills the graph edges with potentials. More... | |
void | fillEdges (const CTrainEdge &edgeTrainer, const vec_mat_t &featureVectors, const vec_float_t &vParams, float weight=1.0f) |
Fills the graph edges with potentials. More... | |
void | defineEdgeGroup (float A, float B, float C, byte group) |
Assign the edges, which cross the given line to the grop group. More... | |
void | setEdges (std::optional< byte > group, const Mat &pot) |
Sets potential pot to all edges in the group group. More... | |
byte | getType (void) const |
Returns the type of the graph. More... | |
Public Member Functions inherited from DirectGraphicalModels::CGraphExt | |
CGraphExt (void)=default | |
CGraphExt (const CGraphExt &)=delete | |
virtual | ~CGraphExt (void)=default |
const CGraphExt & | operator= (const CGraphExt &)=delete |
Private Attributes | |
std::unique_ptr< CGraphLayeredExt > | m_pGraphLayeredExt |
Extended Pairwise graph class for 2D image classifaction.
This graph class provides simplified interface and additional functionality, when the graph is used for 2D image classification
Definition at line 19 of file GraphPairwiseExt.h.
|
inline |
Constructor.
graph | The graph |
gType | The graph type. (Ref. graphEdgesType) |
Definition at line 27 of file GraphPairwiseExt.h.
|
virtualdefault |
|
overridevirtual |
Adds default data-independet edge model.
val | Value, specifying the smoothness strength |
weight | The weighting parameter |
Implements DirectGraphicalModels::CGraphExt.
Definition at line 9 of file GraphPairwiseExt.cpp.
|
overridevirtual |
Adds default contrast-sensitive edge model.
featureVectors | Multi-channel matrix, each element of which is a multi-dimensinal point: Mat(type: CV_8UC<nFeatures>) |
val | Value, specifying the smoothness strength |
weight | The weighting parameter |
Implements DirectGraphicalModels::CGraphExt.
Definition at line 16 of file GraphPairwiseExt.cpp.
|
overridevirtual |
Adds default contrast-sensitive edge model.
featureVectors | Vector of size nFeatures, each element of which is a single feature - image: Mat(type: CV_8UC1) |
val | Value, specifying the smoothness strength |
weight | The weighting parameter |
Implements DirectGraphicalModels::CGraphExt.
Definition at line 24 of file GraphPairwiseExt.cpp.
|
inline |
Adds a block of new feature vectors.
This function may be used only for basic graphical models, built with the CGraphExt::build() method. It extracts pairs of feature vectors with corresponding ground-truth values from blocks featureVectors and gt, according to the graph structure, provided via pGraph
edgeTrainer | A pointer to the edge trainer |
featureVectors | Multi-channel matrix, each element of which is a multi-dimensinal point: Mat(type: CV_8UC<nFeatures>) |
gt | Matrix, each element of which is a ground-truth state (class) |
Definition at line 75 of file GraphPairwiseExt.h.
|
inline |
Adds a block of new feature vectors.
This function may be used only for basic graphical models, built with the CGraphExt::build() method. It extracts pairs of feature vectors with corresponding ground-truth values from blocks featureVectors and gt, according to the graph structure, provided via pGraph
edgeTrainer | A pointer to the edge trainer |
featureVectors | Vector of size nFeatures, each element of which is a single feature - image: Mat(type: CV_8UC1) |
gt | Matrix, each element of which is a ground-truth state (class) |
Definition at line 88 of file GraphPairwiseExt.h.
|
inlineoverridevirtual |
Builds a 2D graph of size corresponding to the image resolution.
When called multiple times, previouse graph structure is always replaced
graphSize | The size of the graph (image resolution) |
Implements DirectGraphicalModels::CGraphExt.
Definition at line 33 of file GraphPairwiseExt.h.
|
inline |
Assign the edges, which cross the given line to the grop group.
The line is given by the equation: Ax + By + C = 0. A and B are not both equal to zero.
A | Constant line parameter |
B | Constant line parameter |
C | Constant line parameter |
group | New group ID |
Definition at line 128 of file GraphPairwiseExt.h.
|
inline |
Fills the graph edges with potentials.
This function uses edgeTrainer class in oerder to achieve edge potentials from feature vectors, stored in featureVectors and fills with them the graph edges
This function supports PPL
edgeTrainer | A pointer to the edge trainer |
featureVectors | Multi-channel matrix, each element of which is a multi-dimensinal point: Mat(type: CV_8UC<nFeatures>) |
vParams | Array of control parameters. Please refer to the concrete model implementation of the CTrainEdge::calculateEdgePotentials() function for more details |
weight | The weighting parameter |
Definition at line 102 of file GraphPairwiseExt.h.
|
inline |
Fills the graph edges with potentials.
This function uses edgeTrainer class in oerder to achieve edge potentials from feature vectors, stored in featureVectors and fills with them the graph edges
This function supports PPL
edgeTrainer | A pointer to the edge trainer |
featureVectors | Vector of size nFeatures, each element of which is a single feature - image: Mat(type: CV_8UC1) |
vParams | Array of control parameters. Please refer to the concrete model implementation of the CTrainEdge::calculateEdgePotentials() function for more details |
weight | The weighting parameter |
Definition at line 116 of file GraphPairwiseExt.h.
|
inlineoverridevirtual |
Returns the size of the graph.
Implements DirectGraphicalModels::CGraphExt.
Definition at line 61 of file GraphPairwiseExt.h.
|
inline |
Returns the type of the graph.
Definition at line 145 of file GraphPairwiseExt.h.
|
inline |
Sets potential pot to all edges in the group group.
pot | Edge potential matrix: Mat(size: nStates x nStates; type: CV_32FC1) |
group | The edge group ID |
Definition at line 137 of file GraphPairwiseExt.h.
|
inlineoverridevirtual |
Fills an existing 2D graph with potentials or builds a new 2D graph of size corresponding to pots.size() with potentials.
If the graph was not build beforehand, or the size of existing graph does not correspond to pots.size() this function calls first
pots | A block of node potentials: Mat(size: image width x image height; type: CV_32FC(nStates)). It may be obtained by: |
Implements DirectGraphicalModels::CGraphExt.
Definition at line 37 of file GraphPairwiseExt.h.
|
private |
Definition at line 152 of file GraphPairwiseExt.h.