Direct Graphical Models  v.1.7.0
DirectGraphicalModels::fex::CGradient Class Reference

Gradient feature extraction class. More...

#include <Gradient.h>

Inheritance diagram for DirectGraphicalModels::fex::CGradient:
Collaboration diagram for DirectGraphicalModels::fex::CGradient:

Public Member Functions

 CGradient (const Mat &img)
 Constructor. More...
 
virtual ~CGradient (void)
 
virtual Mat get (void) const
 Extracts and returns the required feature. More...
 
- Public Member Functions inherited from DirectGraphicalModels::fex::ILocalFeatureExtractor
 ILocalFeatureExtractor (const Mat &img)
 Constructor. More...
 
virtual ~ILocalFeatureExtractor (void)
 
- Public Member Functions inherited from DirectGraphicalModels::fex::IFeatureExtractor
 IFeatureExtractor (const Mat &img)
 Constructor. More...
 
virtual ~IFeatureExtractor (void)
 

Static Public Member Functions

static Mat get (const Mat &img, float mid=GRADIENT_MAX_VALUE)
 Extracts the gradient feature. More...
 

Static Protected Member Functions

static Mat getDerivativeX (const Mat &img)
 
static Mat getDerivativeY (const Mat &img)
 

Friends

class CHOG
 

Additional Inherited Members

- Protected Attributes inherited from DirectGraphicalModels::fex::IFeatureExtractor
const Mat m_img
 Container for the image, from which the features are to be extracted. More...
 

Detailed Description

Gradient feature extraction class.

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 15 of file Gradient.h.

Constructor & Destructor Documentation

◆ CGradient()

DirectGraphicalModels::fex::CGradient::CGradient ( const Mat &  img)
inline

Constructor.

Parameters
imgInput image of type CV_8UC1 or CV_8UC3.

Definition at line 23 of file Gradient.h.

◆ ~CGradient()

virtual DirectGraphicalModels::fex::CGradient::~CGradient ( void  )
inlinevirtual

Definition at line 24 of file Gradient.h.

Member Function Documentation

◆ get() [1/2]

virtual Mat DirectGraphicalModels::fex::CGradient::get ( void  ) const
inlinevirtual

Extracts and returns the required feature.

Returns
The feature image.

Implements DirectGraphicalModels::fex::ILocalFeatureExtractor.

Definition at line 26 of file Gradient.h.

Here is the caller graph for this function:

◆ get() [2/2]

Mat DirectGraphicalModels::fex::CGradient::get ( const Mat &  img,
float  mid = GRADIENT_MAX_VALUE 
)
static

Extracts the gradient feature.

This function calculates the magnitude of gradient of the input image as follows:

\[gradient=\sqrt{\left(\frac{d\,img}{dx}\right)^2+\left(\frac{d\,img}{dy}\right)^2},\]

where \(\frac{d\,img}{dx}\) and \(\frac{d\,img}{dy}\) are the first x and y central derivatives of the input image.
As \(gradient\in[0; 255\,\sqrt{2}]\), this function performs two-linear mapping of the gradient values to the interval \([0; 255]\), such that:

\begin{eqnarray*}0&\rightarrow&0 \\ mid&\rightarrow&255 \\ 255\,\sqrt{2}&\rightarrow&255\end{eqnarray*}

For more details on mapping refer to the two_linear_mapper() function.

Parameters
imgInput image of type CV_8UC1 or CV_8UC3.
midParameter for the two-linear mapping of the feature: \(mid\in(0;255\sqrt{2}]\). (Ref. two_linear_mapper()).
Returns
The gradient feature image of type CV_8UC1.

Definition at line 7 of file Gradient.cpp.

Here is the call graph for this function:

◆ getDerivativeX()

Mat DirectGraphicalModels::fex::CGradient::getDerivativeX ( const Mat &  img)
staticprotected

Definition at line 35 of file Gradient.cpp.

Here is the caller graph for this function:

◆ getDerivativeY()

Mat DirectGraphicalModels::fex::CGradient::getDerivativeY ( const Mat &  img)
staticprotected

Definition at line 49 of file Gradient.cpp.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ CHOG

friend class CHOG
friend

Definition at line 17 of file Gradient.h.


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