Tracore
Public Member Functions | List of all members
util::Filter2D Class Reference

#include <Filter2D.h>

Public Member Functions

 Filter2D ()
 
 Filter2D (double multiplier, std::vector< double > mask)
 
 Filter2D (std::string const &mask_string, char delimiter)
 
double Get (int x, int y) const
 
double Get (int i) const
 
double GetMultiplier () const
 
int GetVicinity () const
 
int GetDimension () const
 
void Normalize ()
 

Detailed Description

Utility class for a two-dimensional filter.

Constructor & Destructor Documentation

util::Filter2D::Filter2D ( )

Creates a new instance with an identity filter.

util::Filter2D::Filter2D ( double  multiplier,
std::vector< double >  mask 
)

Creates a new instance with the given multiplier and mask values. To calculate the value all values are added with their weights from the mask and then the value is multiplied by the multiplier. The multiplier may be used to ensure the overall filter sum is equals one.

Parameters
multiplierThe multiplier
maskThe mask values
util::Filter2D::Filter2D ( std::string const &  mask_string,
char  delimiter 
)

Creates a new instance by parsing the specified mask string. Values are separated by the specified delimiter. Example: 'multiplier, m00, m01, m02, ..., m10, m11, m12, ..., mnn' as the mask string and ',' as the delimiter.

Parameters
mask_stringThe string with the multiplier and the mask values to parse
delimiterThe delimiter used for the parsing

Member Function Documentation

double util::Filter2D::Get ( int  x,
int  y 
) const

Gets the value in the mask at the specified position.

Parameters
xThe horizontal position
yThe vertical position
Returns
The value
double util::Filter2D::Get ( int  i) const

Gets the value in the mask at the specified position.

Parameters
iThe index (row-major)
Returns
The value
int util::Filter2D::GetDimension ( ) const

Gets the dimension of the mask.

Returns
The dimension
double util::Filter2D::GetMultiplier ( ) const

Gets the multiplier.

Returns
The multiplier
int util::Filter2D::GetVicinity ( ) const

Gets the vicinity of the mask. The vicinity is the based on the center and describes the maximum range of values around it in manhattan distance.

Returns
The vicinity
void util::Filter2D::Normalize ( )

Normalizes the mask values. The multiplier is equals one afterwards.


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