Direct Graphical Models  v.1.6.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

## ◆ 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
 Targ Type of elements in matrices a and b (e.g. byte, float, double, etc.) Tres Type of the resulting distance (float or double)
Parameters
 a The first matrix b The 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 92 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
 T The type of the elemets, defining the regions box1 and box2
Return values
 true if regions overlap false otherwise

Definition at line 107 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
 T Type of elements in matrices a and b (e.g. byte, float, double, etc.)
Parameters
 a The first matrix b The second matrix
Return values
 true if a == b false otherwise

Definition at line 26 of file mathop.h.