Direct Graphical Models
v.1.5.2

Common class, which unites feature extraction algorithms. More...
#include <CommonFeatureExtractor.h>
Public Member Functions  
CCommonFeatureExtractor (const Mat &img)  
Constructor. More...  
virtual  ~CCommonFeatureExtractor (void) 
virtual Mat  get (void) const 
Returns the input image. More...  
CGlobalFeatureExtractor  toGlobal (void) const 
Allows for globalfeatures extraction. More...  
CCommonFeatureExtractor  getCoordinate (coordinateType type=COORDINATE_ORDINATE) const 
Extracts a coordinate feature. More...  
CCommonFeatureExtractor  getIntensity (CvScalar weight=CV_RGB(0.333, 0.333, 0.333)) const 
Extracts the intesity feature. More...  
CCommonFeatureExtractor  getHSV (void) const 
Extracts the HSV feature. More...  
CCommonFeatureExtractor  getHue (void) const 
Extracts the hue feature. More...  
CCommonFeatureExtractor  getSaturation (void) const 
Extracts the saturation feature. More...  
CCommonFeatureExtractor  getBrightness (void) const 
Extracts the brightness feature. More...  
CCommonFeatureExtractor  getGradient (float mid=GRADIENT_MAX_VALUE) const 
Extracts the gradient feature. More...  
CCommonFeatureExtractor  getNDVI (byte midPoint=127) const 
Extracts the NDVI (normalized difference vegetation index) feature. More...  
CCommonFeatureExtractor  getDistance (byte threshold=16, double multiplier=4.0) const 
Extracts the distance feature. More...  
CCommonFeatureExtractor  getHOG (int nBins=9, SqNeighbourhood nbhd=sqNeighbourhood(5)) const 
Extracts the HOG (<a href="http://en.wikipedia.org/wiki/Histogram_of_oriented_gradients"target="_blank">histogram of oriented gradients) feature. More...  
CCommonFeatureExtractor  getSIFT () const 
Extracts the SIFT (scaleinvariant feature transform) feature. More...  
CCommonFeatureExtractor  getVariance (SqNeighbourhood nbhd=sqNeighbourhood(5)) const 
Extracts the variance feature. More...  
CCommonFeatureExtractor  getSparseCoding (const Mat &D, SqNeighbourhood nbhd=sqNeighbourhood(3)) const 
Extracts the sparse coding feature. More...  
CCommonFeatureExtractor  reScale (SqNeighbourhood nbhd=sqNeighbourhood(5)) const 
Extracts the scale feature. More...  
CCommonFeatureExtractor  invert (void) const 
Inverts the source image. More...  
CCommonFeatureExtractor  blur (int R=2) const 
Performs Gaussian blurring of the source image. More...  
CCommonFeatureExtractor  autoContrast (void) const 
Performs histogram stretching of the source image. More...  
CCommonFeatureExtractor  thresholding (byte threshold) const 
Performs thresholding on the source image. More...  
CCommonFeatureExtractor  getChannel (int channel) const 
Extracts one channel from the source image. 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) 
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...  
Common class, which unites feature extraction algorithms.
In order to simplify the user feature extraction code, this class provides fluent interface. Please see the example code below for more details.
Definition at line 52 of file CommonFeatureExtractor.h.

inline 
Constructor.
img  Input image. 
Definition at line 59 of file CommonFeatureExtractor.h.

inlinevirtual 
Definition at line 60 of file CommonFeatureExtractor.h.
CCommonFeatureExtractor DirectGraphicalModels::fex::CCommonFeatureExtractor::autoContrast  (  void  )  const 
Performs histogram stretching of the source image.
Definition at line 20 of file CommonFeatureExtractor.cpp.
CCommonFeatureExtractor DirectGraphicalModels::fex::CCommonFeatureExtractor::blur  (  int  R = 2  )  const 
Performs Gaussian blurring of the source image.
R  Radius of the Gaussian filter box: \((2R+1)\times(2R+1)\). 
Definition at line 12 of file CommonFeatureExtractor.cpp.

inlinevirtual 
Returns the input image.
Implements DirectGraphicalModels::fex::ILocalFeatureExtractor.
Definition at line 66 of file CommonFeatureExtractor.h.

inline 
Extracts the brightness feature.
This function represents the input image in HSV (huesaturationvalue) color model and returns the value channel.
Definition at line 110 of file CommonFeatureExtractor.h.
CCommonFeatureExtractor DirectGraphicalModels::fex::CCommonFeatureExtractor::getChannel  (  int  channel  )  const 
Extracts one channel from the source image.
channel  Index of the required channel. 
Definition at line 59 of file CommonFeatureExtractor.cpp.

inline 
Extracts a coordinate feature.
This function calculates the coordinate feature of image pixels, based inly on theirs coordinates.
type  Type of the coordinate feature (Ref. coordinateType). 
Definition at line 79 of file CommonFeatureExtractor.h.

inline 
Extracts the distance feature.
For each pixel of the source image this function calculates the distance to the closest pixel, which value is larger or equal to threshold. Resulting feature image is multiplied by multiplier
threshold  Threshold value. 
multiplier  Amplification coefficient for the resulting feature image. 
Definition at line 147 of file CommonFeatureExtractor.h.

inline 
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 twolinear 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.
mid  Parameter for the twolinear mapping of the feature: \(mid\in(0;255\sqrt{2}]\). (Ref. two_linear_mapper()). 
Definition at line 121 of file CommonFeatureExtractor.h.

inline 
Extracts the HOG (<a href="http://en.wikipedia.org/wiki/Histogram_of_oriented_gradients"target="_blank">histogram of oriented gradients) feature.
For each pixel of the source image this function calculates the histogram of oriented gradients inside the pixel's neighbourhood nbhd. The histogram consists of nBins values, it is normalized, and stored as nBins channel image, thus, the channel index corresponds to the histogram index.
nBins  Number of bins. Hence a single bin covers an angle of \(\frac{180^\circ}{nBins}\). 
nbhd  Neighborhood around the pixel, where its histogram is estimated. (Ref. SqNeighbourhood). 
Definition at line 156 of file CommonFeatureExtractor.h.

inline 
Extracts the HSV feature.
This function transforms the input image into HSV (huesaturationvalue) color space.
Definition at line 92 of file CommonFeatureExtractor.h.

inline 
Extracts the hue feature.
This function represents the input image in HSV (huesaturationvalue) color model and returns the hue channel.
Definition at line 98 of file CommonFeatureExtractor.h.

inline 
Extracts the intesity feature.
This function calculates the intesity of the input image as follows:
\[ intensity=weight_0\cdot img.RED+weight_1\cdot img.GREEN+weight_2\cdot img.BLUE \]
weight  The weight coefficients, which determine the contribution of each color channel to the resulting intensity. 
Definition at line 86 of file CommonFeatureExtractor.h.

inline 
Extracts the NDVI (normalized difference vegetation index) feature.
This function calculates the NDVI from the input image as follows:
\[ NDVI=\frac{NIRVIS}{NIR+VIS},\]
where \(NIR\) designates the nearinfrared data, and \(VIS\)  visible data. The algorithm assumes that the nearinfrared data is stored in the red image channel and the visible data  in the remaining two channels:
\begin{eqnarray*}NIR&=&img.RED \\ VIS&=&\frac{1}{2}\,img.GREEN+\frac{1}{2}\,img.BLUE.\end{eqnarray*}
As \(NDVI\in[1; 1]\), this function performs twolinear mapping of the NDVI values to the interval \([0; 255]\), such that:
\begin{eqnarray*}1&\rightarrow&0 \\ 0&\rightarrow&midPoint \\ 1&\rightarrow&255\end{eqnarray*}
For more details on mapping refer to the two_linear_mapper() function.
midPoint  Parameter for the twolinear mapping of the feature (Ref. two_linear_mapper()).

Definition at line 138 of file CommonFeatureExtractor.h.

inline 
Extracts the saturation feature.
This function represents the input image in HSV (huesaturationvalue) color model and returns the saturation channel.
Definition at line 104 of file CommonFeatureExtractor.h.

inline 
Extracts the SIFT (scaleinvariant feature transform) feature.
For each pixel of the source image this function performs the scaleinvariant feature transform.
Definition at line 162 of file CommonFeatureExtractor.h.

inline 
Extracts the sparse coding feature.
For each pixel of the source image this function calculates the sparse coding feature within the pixel's neighbourhood nbhd.
This fuction supports dictionaries with nWords less or equal to 512 words. For larger dictionaries use CSparseCoding::get_v() function directly.
D  Sparse dictionary \(D\): Mat(size nWords x blockSize^2; type CV_32FC1).

nbhd  Neighborhood around the pixel, where the feature is estimated. (Ref. SqNeighbourhood). 
Definition at line 180 of file CommonFeatureExtractor.h.

inline 
Extracts the variance feature.
For each pixel of the source image this function calculates the variance within the pixel's neighbourhood nbhd.
nbhd  Neighborhood around the pixel, where the variance is estimated. (Ref. SqNeighbourhood). 
Definition at line 169 of file CommonFeatureExtractor.h.
CCommonFeatureExtractor DirectGraphicalModels::fex::CCommonFeatureExtractor::invert  (  void  )  const 
Inverts the source image.
Definition at line 5 of file CommonFeatureExtractor.cpp.

inline 
Extracts the scale feature.
For each pixel of the source image this function calculates the mean value within the pixel's neighbourhood nbhd. Using different neighbourhood radii, it alows for different scale representations of the nput features.
nbhd  Neighborhood around the pixel, where the mean is estimated. (Ref. SqNeighbourhood). 
Definition at line 188 of file CommonFeatureExtractor.h.
CCommonFeatureExtractor DirectGraphicalModels::fex::CCommonFeatureExtractor::thresholding  (  byte  threshold  )  const 
Performs thresholding on the source image.
\[ res_i = \left\{\begin{array}{ll} 255 & \text{if}~~res_i > threshold \\ 0 & \text{otherwise} \end{array} \right. \]
Definition at line 43 of file CommonFeatureExtractor.cpp.

inline 
Allows for globalfeatures extraction.
Definition at line 72 of file CommonFeatureExtractor.h.