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

NDVI (normalized difference vegetation index) feature extraction class. More...

#include <NDVI.h>

Inheritance diagram for DirectGraphicalModels::fex::CNDVI:
Collaboration diagram for DirectGraphicalModels::fex::CNDVI:

Public Member Functions

 CNDVI (const Mat &img)
 Constructor. More...
 
virtual ~CNDVI (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, byte midPoint=127)
 Extracts the NDVI feature. More...
 

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

NDVI (normalized difference vegetation index) 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 14 of file NDVI.h.

Constructor & Destructor Documentation

◆ CNDVI()

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

Constructor.

Parameters
imgInput image of type CV_8UC3.

Definition at line 21 of file NDVI.h.

◆ ~CNDVI()

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

Definition at line 22 of file NDVI.h.

Member Function Documentation

◆ get() [1/2]

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

Extracts and returns the required feature.

Returns
The feature image.

Implements DirectGraphicalModels::fex::ILocalFeatureExtractor.

Definition at line 24 of file NDVI.h.

Here is the caller graph for this function:

◆ get() [2/2]

Mat DirectGraphicalModels::fex::CNDVI::get ( const Mat &  img,
byte  midPoint = 127 
)
static

Extracts the NDVI feature.

This function calculates the NDVI from the input image as follows:

\[ NDVI=\frac{NIR-VIS}{NIR+VIS},\]

where \(NIR\) designates the near-infra-red data, and \(VIS\) - visible data. The algorithm assumes that the near-infra-red 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 two-linear 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.

Parameters
imgInput image of type CV_8UC3, where near-infra-red data is stored in the red channel.
midPointParameter for the two-linear mapping of the feature (Ref. two_linear_mapper()).

Common values are:

  • 0     - cut off the negative NDVI values;
  • 127 - linear mapping;
  • 255 - cut off the positive NDVI values.
Returns
The NDVI feature image of type CV_8UC1.

Definition at line 7 of file NDVI.cpp.


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