Direct Graphical Models  v.1.7.0
EdgeModelPotts.h
1 // Potts Edge Model class interface
2 // Written by Sergey G. Kosov in 2019 for Project X
3 #pragma once
4 
5 #include "IEdgeModel.h"
6 #include "permutohedral/permutohedral.h"
7 
8 namespace DirectGraphicalModels {
9  // ================================ Potts Edge Model ================================
17  class CEdgeModelPotts : public IEdgeModel {
18  public:
31  CEdgeModelPotts(const Mat& features, float weight = 1.0f, const std::function<void(const Mat& src, Mat& dst)>& semiMetricFunction = {}, bool perPixelNormalization = true);
32  virtual ~CEdgeModelPotts(void) = default;
33 
34  void apply(const Mat &src, Mat &dst) const override;
35 
36 
37  private:
38  std::unique_ptr<CPermutohedral> m_pLattice;
39  float m_weight;
40  Mat m_norm;
41  std::function<void(const Mat &src, Mat &dst)> m_function;
42  };
43 }
std::function< void(const Mat &src, Mat &dst)> m_function
The semi-metric function.
std::unique_ptr< CPermutohedral > m_pLattice
Pointer to the permutohedral lattice.
Interface class for edge models used in dense graphical models.
Definition: IEdgeModel.h:14
float m_weight
The weighting parameter.
void apply(const Mat &src, Mat &dst) const override
Applies an edge model to the node potentials of a dense graph.
virtual ~CEdgeModelPotts(void)=default
Potts Edge Model for dense graphical models.
Mat m_norm
Array with normalization factors.
CEdgeModelPotts(const Mat &features, float weight=1.0f, const std::function< void(const Mat &src, Mat &dst)> &semiMetricFunction={}, bool perPixelNormalization=true)
Constructor.