#include <Filter.h>
GRT::Filter::Filter |
( |
const char * |
classType, |
|
|
UINT |
filterSize = 5 , |
|
|
UINT |
numDimensions = 1 |
|
) |
| |
Constructor, sets the size of the median filter and the dimensionality of the data it will filter.
- Parameters
-
char | *classType: the name of the sub-class being instantiated. |
UINT | filterSize: the size of the median filter, should be a value greater than zero. Default filterSize = 5 |
UINT | numDimensions: the dimensionality of the data to filter. Default numDimensions = 1 |
GRT::Filter::Filter |
( |
const Filter & |
rhs | ) |
|
Copy Constructor, copies the Filter from the rhs instance to this instance
- Parameters
-
const | Filter &rhs: another instance of the Filter class from which the data will be copied to this instance |
virtual double GRT::Filter::computeFilter |
( |
const VectorDouble & |
buf | ) |
|
|
pure virtual |
Compute the filter. This is implemented by the derived class and called separately on each dimension of the input data.
- Parameters
-
const | VectorDouble buf: the values to filter, i.e. the last filterSize (or fewer) values read within a particular dimension |
- Returns
- the filtered value
Implemented in LogEnergy.
bool GRT::Filter::deepCopyFrom |
( |
const PreProcessing * |
preProcessing | ) |
|
|
virtual |
Sets the PreProcessing deepCopyFrom function, overwriting the base PreProcessing function. This function is used to deep copy the values from the input pointer to this instance of the PreProcessing module. This function is called by the GestureRecognitionPipeline when the user adds a new PreProcessing module to the pipeline.
- Parameters
-
const | PreProcessing *preProcessing: a pointer to another instance of a Filter, the values of that instance will be cloned to this instance |
- Returns
- true if the deep copy was successful, false otherwise
double GRT::Filter::filter |
( |
const double |
x | ) |
|
Filters the input, this should only be called if the dimensionality of the filter was set to 1.
- Parameters
-
double | x: the value to filter, this should only be called if the dimensionality of the filter was set to 1 |
- Returns
- the filtered value. Zero will be returned if the value was not filtered
VectorDouble GRT::Filter::filter |
( |
const VectorDouble & |
x | ) |
|
Filters the input, the dimensionality of the input vector should match that of the filter.
- Parameters
-
const | VectorDouble &x: the values to filter, the dimensionality of the input vector should match that of the filter |
- Returns
- the filtered values. An empty vector will be returned if the values were not filtered
vector< VectorDouble > GRT::Filter::getDataBuffer |
( |
| ) |
const |
Returns the current data in the dataBuffer. This will be a [N M] vector of VectorDoubles, where N is the number of dimensions in the filter and M is the size of the buffer. If the filter has not been initialized then an empty vector will be returned.
- Returns
- the current data in the dataBuffer
VectorDouble GRT::Filter::getFilteredData |
( |
| ) |
const |
|
inline |
Returns the last value(s) that were filtered.
- Returns
- the filtered values. An empty vector will be returned if the values were not filtered
UINT GRT::Filter::getFilterSize |
( |
| ) |
const |
|
inline |
Gets the current filter size.
- Returns
- returns the filter size
bool GRT::Filter::init |
( |
UINT |
filterSize, |
|
|
UINT |
numDimensions |
|
) |
| |
Initializes the filter, setting the filter size and dimensionality of the data it will filter. Sets all the filter values to zero.
- Parameters
-
UINT | filterSize: the size of the moving average filter, should be a value greater than zero |
- Returns
- true if the filter was initiliazed, false otherwise
bool GRT::Filter::loadModelFromFile |
( |
string |
filename | ) |
|
|
virtual |
This loads the Filter settings from a file. This overrides the loadModelFromFile function in the PreProcessing base class.
- Parameters
-
string | filename: the name of the file to load the settings from |
- Returns
- returns true if the settings were loaded successfully, false otherwise
bool GRT::Filter::loadModelFromFile |
( |
fstream & |
file | ) |
|
|
virtual |
This loads the Filter settings from a file. This overrides the loadModelFromFile function in the PreProcessing base class.
- Parameters
-
fstream | &file: a reference to the file to load the settings from |
- Returns
- returns true if the model was loaded successfully, false otherwise
Sets the equals operator, copies the data from the rhs instance to this instance
- Parameters
-
const | Filter &rhs: another instance of the Filter class from which the data will be copied to this instance |
- Returns
- a reference to this instance of Filter
bool GRT::Filter::process |
( |
const VectorDouble & |
inputVector | ) |
|
|
virtual |
Sets the PreProcessing process function, overwriting the base PreProcessing function. This function is called by the GestureRecognitionPipeline when any new input data needs to be processed (during the prediction phase for example). This function calls the Filter's filter function.
- Parameters
-
const | VectorDouble &inputVector: the inputVector that should be processed. Must have the same dimensionality as the PreProcessing module |
- Returns
- true if the data was processed, false otherwise
bool GRT::Filter::reset |
( |
| ) |
|
|
virtual |
Sets the PreProcessing reset function, overwriting the base PreProcessing function. This function is called by the GestureRecognitionPipeline when the pipelines main reset() function is called. This function resets the filter values by re-initiliazing the filter.
- Returns
- true if the filter was reset, false otherwise
bool GRT::Filter::saveModelToFile |
( |
string |
filename | ) |
const |
|
virtual |
This saves the current settings of the Filter to a file. This overrides the saveModelToFile function in the PreProcessing base class.
- Parameters
-
string | filename: the name of the file to save the settings to |
- Returns
- returns true if the model was saved successfully, false otherwise
bool GRT::Filter::saveModelToFile |
( |
fstream & |
file | ) |
const |
|
virtual |
This saves the current settings of the Filter to a file. This overrides the saveModelToFile function in the PreProcessing base class.
- Parameters
-
fstream | &file: a reference to the file the settings will be saved to |
- Returns
- returns true if the settings were saved successfully, false otherwise
CircularBuffer< VectorDouble > GRT::Filter::dataBuffer |
|
protected |
A buffer to store the previous N values, N = filterSize.
UINT GRT::Filter::filterSize |
|
protected |
UINT GRT::Filter::inputSampleCounter |
|
protected |
A counter to keep track of the number of input samples.
The documentation for this class was generated from the following files: