Direct Graphical Models  v.1.7.0
DirectGraphicalModels::mathop Namespace Reference

Mathematical operations. More...

Functions

template<typename T >
bool isEqual (const Mat &a, const Mat &b)
 Compares two argument matrices a and b. More...
 
template<typename Targ = float, typename Tres = float>
Tres Euclidian (const Mat &a, const Mat &b)
 Calculates the Euclidian distance between argument matrices a and b. More...
 
template<typename T >
Euclidian (const std::vector< T > &a, const std::vector< T > &b)
 
template<typename T >
bool ifOverlap (pair_mat_t &box1, pair_mat_t &box2)
 Checks whether two regions box1 and box2 overlap each other. More...
 

Detailed Description

Mathematical operations.

This namespace collects some mathematical operations on matrices

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

Function Documentation

◆ Euclidian() [1/2]

template<typename Targ = float, typename Tres = float>
Tres DirectGraphicalModels::mathop::Euclidian ( const Mat &  a,
const Mat &  b 
)
inline

Calculates the Euclidian distance between argument matrices a and b.

The Euclidian distance is calculated by the formula : \(D_E(a, b) = \sqrt{ \sum_{i,j}(a_{ij} - b_{ij})^2 }\).

This function is about 10 times faster then cv::norm(a, b, NORM_L2);

Template Parameters
TargType of elements in matrices a and b (e.g. byte, float, double, etc.)
TresType of the resulting distance (float or double)
Parameters
aThe first matrix
bThe second matrix
Returns
The Euclidian distance : \(D_E(a, b)\)

Definition at line 62 of file mathop.h.

◆ Euclidian() [2/2]

template<typename T >
T DirectGraphicalModels::mathop::Euclidian ( const std::vector< T > &  a,
const std::vector< T > &  b 
)
inline

Definition at line 91 of file mathop.h.

◆ ifOverlap()

template<typename T >
bool DirectGraphicalModels::mathop::ifOverlap ( pair_mat_t &  box1,
pair_mat_t &  box2 
)

Checks whether two regions box1 and box2 overlap each other.

Template Parameters
TThe type of the elemets, defining the regions box1 and box2
Return values
trueif regions overlap
falseotherwise

Definition at line 106 of file mathop.h.

◆ isEqual()

template<typename T >
bool DirectGraphicalModels::mathop::isEqual ( const Mat &  a,
const Mat &  b 
)
inline

Compares two argument matrices a and b.

Template Parameters
TType of elements in matrices a and b (e.g. byte, float, double, etc.)
Parameters
aThe first matrix
bThe second matrix
Return values
trueif a == b
falseotherwise

Definition at line 26 of file mathop.h.