Direct Graphical Models  v.1.7.0
DirectGraphicalModels::CGraphDenseExt Class Reference

Extended Dense graph class for 2D image classifaction. More...

#include <GraphDenseExt.h>

Inheritance diagram for DirectGraphicalModels::CGraphDenseExt:
Collaboration diagram for DirectGraphicalModels::CGraphDenseExt:

Public Member Functions

 CGraphDenseExt (CGraphDense &graph)
 Constructor. More...
 
 ~CGraphDenseExt (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 (void) const override
 Returns the size of the graph. More...
 
void addGaussianEdgeModel (Vec2f sigma, float weight=1.0f, const std::function< void(const Mat &src, Mat &dst)> &semiMetricFunction={})
 Add a Gaussian potential model with standard deviation sigma. More...
 
void addBilateralEdgeModel (const Mat &featureVectors, Vec2f sigma, float sigma_opt=1.0f, float weight=1.0f, const std::function< void(const Mat &src, Mat &dst)> &semiMetricFunction={})
 Add a Bilateral pairwise potential with spacial standard deviations sigma and color standard deviations sr,sg,sb. More...
 
void addBilateralEdgeModel (const vec_mat_t &featureVectors, Vec2f sigma, float sigma_opt=1.0f, float weight=1.0f, const std::function< void(const Mat &src, Mat &dst)> &semiMetricFunction={})
 Add a Bilateral pairwise potential with spacial standard deviations sx, sy and color standard deviations sr,sg,sb. More...
 
- Public Member Functions inherited from DirectGraphicalModels::CGraphExt
 CGraphExt (void)=default
 
 CGraphExt (const CGraphExt &)=delete
 
virtual ~CGraphExt (void)=default
 
const CGraphExtoperator= (const CGraphExt &)=delete
 

Private Attributes

CGraphDensem_graph
 The graph. More...
 
Size m_size
 Size of the 2D graph. More...
 

Detailed Description

Extended Dense graph class for 2D image classifaction.

This graph class provides simplified interface and additional functionality, when the graph is used for 2D image classification

Author
Sergey G. Kosov, serge.nosp@m.y.ko.nosp@m.sov@p.nosp@m.roje.nosp@m.ct-10.nosp@m..de

Definition at line 17 of file GraphDenseExt.h.

Constructor & Destructor Documentation

◆ CGraphDenseExt()

DirectGraphicalModels::CGraphDenseExt::CGraphDenseExt ( CGraphDense graph)
inline

Constructor.

Parameters
graphThe graph

Definition at line 24 of file GraphDenseExt.h.

◆ ~CGraphDenseExt()

DirectGraphicalModels::CGraphDenseExt::~CGraphDenseExt ( void  )
default

Member Function Documentation

◆ addBilateralEdgeModel() [1/2]

void DirectGraphicalModels::CGraphDenseExt::addBilateralEdgeModel ( const Mat &  featureVectors,
Vec2f  sigma,
float  sigma_opt = 1.0f,
float  weight = 1.0f,
const std::function< void(const Mat &src, Mat &dst)> &  semiMetricFunction = {} 
)

Add a Bilateral pairwise potential with spacial standard deviations sigma and color standard deviations sr,sg,sb.

Parameters
featureVectorsMulti-channel matrix, each element of which is a multi-dimensinal point: Mat(type: CV_8UC<nFeatures>)
sigmaThe spatial standard deviation of the 2D-bilateral filter
sigma_optThe standard deviation for featureVectors
weightThe weighting parameter
semiMetricFunctionReference to a semi-metric function, which arguments src and dst are: Mat(size: 1 x nFeatures; type: CV_32FC1). For more details refere to CEdgeModelPotts.

Definition at line 47 of file GraphDenseExt.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addBilateralEdgeModel() [2/2]

void DirectGraphicalModels::CGraphDenseExt::addBilateralEdgeModel ( const vec_mat_t &  featureVectors,
Vec2f  sigma,
float  sigma_opt = 1.0f,
float  weight = 1.0f,
const std::function< void(const Mat &src, Mat &dst)> &  semiMetricFunction = {} 
)

Add a Bilateral pairwise potential with spacial standard deviations sx, sy and color standard deviations sr,sg,sb.

Parameters
featureVectorsMulti-channel matrix, each element of which is a multi-dimensinal point: Mat(type: CV_8UC<nFeatures>)
sigmaThe spatial standard deviation of the 2D-bilateral filter
sigma_optThe standard deviation for featureVectors
weightThe weighting parameter
semiMetricFunctionReference to a semi-metric function, which arguments src and dst are: Mat(size: 1 x nFeatures; type: CV_32FC1). For more details refere to CEdgeModelPotts.

Definition at line 68 of file GraphDenseExt.cpp.

Here is the call graph for this function:

◆ addDefaultEdgesModel() [1/3]

void DirectGraphicalModels::CGraphDenseExt::addDefaultEdgesModel ( float  val,
float  weight = 1.0f 
)
inlineoverridevirtual

Adds default data-independet edge model.

This function adds a Gaussian edge model to the dense CRF model

Parameters
valValue, specifying the smoothness strength - in this case the spatial standard deviation of the 2D-Gaussian filter scaled by 33.(3)
weightThe weighting parameter

Implements DirectGraphicalModels::CGraphExt.

Definition at line 36 of file GraphDenseExt.h.

Here is the call graph for this function:

◆ addDefaultEdgesModel() [2/3]

void DirectGraphicalModels::CGraphDenseExt::addDefaultEdgesModel ( const Mat &  featureVectors,
float  val,
float  weight = 1.0f 
)
inlineoverridevirtual

Adds default contrast-sensitive edge model.

This function adds a Bilateral edge model to the dense CRF model

Parameters
featureVectorsMulti-channel matrix, each element of which is a multi-dimensinal point: Mat(type: CV_8UC<nFeatures>)
valValue, specifying the smoothness strength - in this case the spatial standard deviation of the 2D-bilateral filter scaled by 33.(3)
weightThe weighting parameter

Implements DirectGraphicalModels::CGraphExt.

Definition at line 47 of file GraphDenseExt.h.

Here is the call graph for this function:

◆ addDefaultEdgesModel() [3/3]

void DirectGraphicalModels::CGraphDenseExt::addDefaultEdgesModel ( const vec_mat_t &  featureVectors,
float  val,
float  weight = 1.0f 
)
inlineoverridevirtual

Adds default contrast-sensitive edge model.

This function adds a Bilateral edge model to the dense CRF model

Parameters
featureVectorsVector of size nFeatures, each element of which is a single feature - image: Mat(type: CV_8UC1)
valValue, specifying the smoothness strength - in this case the spatial standard deviation of the 2D-bilateral filter scaled by 33.(3)
weightThe weighting parameter

Implements DirectGraphicalModels::CGraphExt.

Definition at line 58 of file GraphDenseExt.h.

Here is the call graph for this function:

◆ addGaussianEdgeModel()

void DirectGraphicalModels::CGraphDenseExt::addGaussianEdgeModel ( Vec2f  sigma,
float  weight = 1.0f,
const std::function< void(const Mat &src, Mat &dst)> &  semiMetricFunction = {} 
)

Add a Gaussian potential model with standard deviation sigma.

Parameters
sigmaThe spatial standard deviation of the 2D-Gaussian filter
weightThe weighting parameter
semiMetricFunctionReference to a semi-metric function, which arguments src and dst are: Mat(size: 1 x nFeatures; type: CV_32FC1). For more details refere to CEdgeModelPotts.

Definition at line 32 of file GraphDenseExt.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buildGraph()

void DirectGraphicalModels::CGraphDenseExt::buildGraph ( Size  graphSize)
overridevirtual

Builds a 2D graph of size corresponding to the image resolution.

When called multiple times, previouse graph structure is always replaced

Parameters
graphSizeThe size of the graph (image resolution)

Implements DirectGraphicalModels::CGraphExt.

Definition at line 8 of file GraphDenseExt.cpp.

Here is the call graph for this function:

◆ getSize()

Size DirectGraphicalModels::CGraphDenseExt::getSize ( void  ) const
inlineoverridevirtual

Returns the size of the graph.

Returns
The size of the Graph

Implements DirectGraphicalModels::CGraphExt.

Definition at line 62 of file GraphDenseExt.h.

◆ setGraph()

void DirectGraphicalModels::CGraphDenseExt::setGraph ( const Mat &  pots)
overridevirtual

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

buildGraph(pots.size())
Parameters
potsA 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 20 of file GraphDenseExt.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ m_graph

CGraphDense& DirectGraphicalModels::CGraphDenseExt::m_graph
private

The graph.

Definition at line 96 of file GraphDenseExt.h.

◆ m_size

Size DirectGraphicalModels::CGraphDenseExt::m_size
private

Size of the 2D graph.

Definition at line 97 of file GraphDenseExt.h.


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