GestureRecognitionToolkit  Version: 0.2.5
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
FFT Class Reference
Inheritance diagram for FFT:
FeatureExtraction MLBase GRTBase Observer< TrainingResult > Observer< TestInstanceResult >

Public Types

enum  FFTWindowFunctionOptions { RECTANGULAR_WINDOW =0, BARTLETT_WINDOW, HAMMING_WINDOW, HANNING_WINDOW }
 
- Public Types inherited from FeatureExtraction
typedef std::map< std::string, FeatureExtraction *(*)() > StringFeatureExtractionMap
 
- Public Types inherited from MLBase
enum  BaseType {
  BASE_TYPE_NOT_SET =0, CLASSIFIER, REGRESSIFIER, CLUSTERER,
  PRE_PROCSSING, POST_PROCESSING, FEATURE_EXTRACTION, CONTEXT
}
 

Public Member Functions

 FFT (const UINT fftWindowSize=512, const UINT hopSize=1, const UINT numDimensions=1, const UINT fftWindowFunction=RECTANGULAR_WINDOW, const bool computeMagnitude=true, const bool computePhase=true)
 
 FFT (const FFT &rhs)
 
virtual ~FFT (void)
 
FFToperator= (const FFT &rhs)
 
virtual bool deepCopyFrom (const FeatureExtraction *featureExtraction)
 
virtual bool computeFeatures (const VectorFloat &inputVector)
 
virtual bool computeFeatures (const MatrixFloat &inputMatrix)
 
virtual bool clear ()
 
virtual bool reset ()
 
virtual bool save (std::fstream &file) const
 
virtual bool load (std::fstream &file)
 
bool init (const UINT fftWindowSize, const UINT hopSize=1, const UINT numDimensions=1, const UINT windowFunction=RECTANGULAR_WINDOW, const bool computeMagnitude=true, const bool computePhase=true, const DataType inputType=DATA_TYPE_VECTOR, const DataType outputType=DATA_TYPE_VECTOR)
 
bool update (const Float x)
 
bool update (const VectorFloat &x)
 
bool update (const MatrixFloat &x)
 
UINT getHopSize () const
 
UINT getDataBufferSize () const
 
UINT getFFTWindowSize () const
 
UINT getFFTWindowFunction () const
 
UINT getHopCounter () const
 
bool getComputeMagnitude () const
 
bool getComputePhase () const
 
Vector< FastFourierTransformgetFFTResults () const
 
Vector< FastFourierTransform > & getFFTResultsPtr ()
 
const Vector< FastFourierTransform > & getFFTResultsPtr () const
 
VectorFloat getFrequencyBins (const unsigned int sampleRate) const
 
bool setHopSize (const UINT hopSize)
 
bool setFFTWindowSize (const UINT fftWindowSize)
 
bool setFFTWindowFunction (const UINT fftWindowFunction)
 
bool setComputeMagnitude (const bool computeMagnitude)
 
bool setComputePhase (const bool computePhase)
 
- Public Member Functions inherited from FeatureExtraction
 FeatureExtraction (const std::string id="")
 
virtual ~FeatureExtraction ()
 
bool copyBaseVariables (const FeatureExtraction *featureExtractionModule)
 
bool getInitialized () const
 
bool getFeatureDataReady () const
 
const VectorFloatgetFeatureVector () const
 
const MatrixFloatgetFeatureMatrix () const
 
FeatureExtractioncreate () const
 
 GRT_DEPRECATED_MSG ("createNewInstance is deprecated, use create() instead.", FeatureExtraction *createNewInstance() const )
 
 GRT_DEPRECATED_MSG ("createInstanceFromString(id) is deprecated, use create(id) instead.", static FeatureExtraction *createInstanceFromString(const std::string &id))
 
 GRT_DEPRECATED_MSG ("getFeatureExtractionType is deprecated, use getId() instead", std::string getFeatureExtractionType() const )
 
- Public Member Functions inherited from MLBase
 MLBase (const std::string &id="", const BaseType type=BASE_TYPE_NOT_SET)
 
virtual ~MLBase (void)
 
bool copyMLBaseVariables (const MLBase *mlBase)
 
virtual bool train (ClassificationData trainingData)
 
virtual bool train_ (ClassificationData &trainingData)
 
virtual bool train (RegressionData trainingData)
 
virtual bool train_ (RegressionData &trainingData)
 
virtual bool train (RegressionData trainingData, RegressionData validationData)
 
virtual bool train_ (RegressionData &trainingData, RegressionData &validationData)
 
virtual bool train (TimeSeriesClassificationData trainingData)
 
virtual bool train_ (TimeSeriesClassificationData &trainingData)
 
virtual bool train (ClassificationDataStream trainingData)
 
virtual bool train_ (ClassificationDataStream &trainingData)
 
virtual bool train (UnlabelledData trainingData)
 
virtual bool train_ (UnlabelledData &trainingData)
 
virtual bool train (MatrixFloat data)
 
virtual bool train_ (MatrixFloat &data)
 
virtual bool predict (VectorFloat inputVector)
 
virtual bool predict_ (VectorFloat &inputVector)
 
virtual bool predict (MatrixFloat inputMatrix)
 
virtual bool predict_ (MatrixFloat &inputMatrix)
 
virtual bool map (VectorFloat inputVector)
 
virtual bool map_ (VectorFloat &inputVector)
 
virtual bool print () const
 
virtual bool save (const std::string &filename) const
 
virtual bool load (const std::string &filename)
 
 GRT_DEPRECATED_MSG ("saveModelToFile(std::string filename) is deprecated, use save(const std::string &filename) instead", virtual bool saveModelToFile(const std::string &filename) const )
 
 GRT_DEPRECATED_MSG ("saveModelToFile(std::fstream &file) is deprecated, use save(std::fstream &file) instead", virtual bool saveModelToFile(std::fstream &file) const )
 
 GRT_DEPRECATED_MSG ("loadModelFromFile(std::string filename) is deprecated, use load(const std::string &filename) instead", virtual bool loadModelFromFile(const std::string &filename))
 
 GRT_DEPRECATED_MSG ("loadModelFromFile(std::fstream &file) is deprecated, use load(std::fstream &file) instead", virtual bool loadModelFromFile(std::fstream &file))
 
virtual bool getModel (std::ostream &stream) const
 
virtual std::string getModelAsString () const
 
DataType getInputType () const
 
DataType getOutputType () const
 
BaseType getType () const
 
UINT getNumInputFeatures () const
 
UINT getNumInputDimensions () const
 
UINT getNumOutputDimensions () const
 
UINT getMinNumEpochs () const
 
UINT getMaxNumEpochs () const
 
UINT getBatchSize () const
 
UINT getNumRestarts () const
 
UINT getValidationSetSize () const
 
UINT getNumTrainingIterationsToConverge () const
 
Float getMinChange () const
 
Float getLearningRate () const
 
Float getRMSTrainingError () const
 
 GRT_DEPRECATED_MSG ("getRootMeanSquaredTrainingError() is deprecated, use getRMSTrainingError() instead", Float getRootMeanSquaredTrainingError() const )
 
Float getTotalSquaredTrainingError () const
 
Float getRMSValidationError () const
 
Float getValidationSetAccuracy () const
 
VectorFloat getValidationSetPrecision () const
 
VectorFloat getValidationSetRecall () const
 
bool getUseValidationSet () const
 
bool getRandomiseTrainingOrder () const
 
bool getTrained () const
 
 GRT_DEPRECATED_MSG ("getModelTrained() is deprecated, use getTrained() instead", bool getModelTrained() const )
 
bool getConverged () const
 
bool getScalingEnabled () const
 
bool getIsBaseTypeClassifier () const
 
bool getIsBaseTypeRegressifier () const
 
bool getIsBaseTypeClusterer () const
 
bool getTrainingLoggingEnabled () const
 
bool getTestingLoggingEnabled () const
 
bool enableScaling (const bool useScaling)
 
bool setMaxNumEpochs (const UINT maxNumEpochs)
 
bool setBatchSize (const UINT batchSize)
 
bool setMinNumEpochs (const UINT minNumEpochs)
 
bool setNumRestarts (const UINT numRestarts)
 
bool setMinChange (const Float minChange)
 
bool setLearningRate (const Float learningRate)
 
bool setUseValidationSet (const bool useValidationSet)
 
bool setValidationSetSize (const UINT validationSetSize)
 
bool setRandomiseTrainingOrder (const bool randomiseTrainingOrder)
 
bool setTrainingLoggingEnabled (const bool loggingEnabled)
 
bool setTestingLoggingEnabled (const bool loggingEnabled)
 
bool registerTrainingResultsObserver (Observer< TrainingResult > &observer)
 
bool registerTestResultsObserver (Observer< TestInstanceResult > &observer)
 
bool removeTrainingResultsObserver (const Observer< TrainingResult > &observer)
 
bool removeTestResultsObserver (const Observer< TestInstanceResult > &observer)
 
bool removeAllTrainingObservers ()
 
bool removeAllTestObservers ()
 
bool notifyTrainingResultsObservers (const TrainingResult &data)
 
bool notifyTestResultsObservers (const TestInstanceResult &data)
 
MLBasegetMLBasePointer ()
 
const MLBasegetMLBasePointer () const
 
Vector< TrainingResultgetTrainingResults () const
 
- Public Member Functions inherited from GRTBase
 GRTBase (const std::string &id="")
 
virtual ~GRTBase (void)
 
bool copyGRTBaseVariables (const GRTBase *GRTBase)
 
 GRT_DEPRECATED_MSG ("getClassType is deprecated, use getId() instead!", std::string getClassType() const )
 
std::string getId () const
 
std::string getLastWarningMessage () const
 
std::string getLastErrorMessage () const
 
std::string getLastInfoMessage () const
 
bool setInfoLoggingEnabled (const bool loggingEnabled)
 
bool setWarningLoggingEnabled (const bool loggingEnabled)
 
bool setErrorLoggingEnabled (const bool loggingEnabled)
 
bool setDebugLoggingEnabled (const bool loggingEnabled)
 
GRTBasegetGRTBasePointer ()
 
const GRTBasegetGRTBasePointer () const
 
Float scale (const Float &x, const Float &minSource, const Float &maxSource, const Float &minTarget, const Float &maxTarget, const bool constrain=false)
 
Float SQR (const Float &x) const
 
- Public Member Functions inherited from Observer< TrainingResult >
virtual void notify (const TrainingResult &data)
 
- Public Member Functions inherited from Observer< TestInstanceResult >
virtual void notify (const TestInstanceResult &data)
 

Static Public Member Functions

static std::string getId ()
 
- Static Public Member Functions inherited from FeatureExtraction
static FeatureExtractioncreate (const std::string &id)
 
- Static Public Member Functions inherited from GRTBase
static std::string getGRTVersion (bool returnRevision=true)
 
static std::string getGRTRevison ()
 

Protected Member Functions

bool isPowerOfTwo (UINT x)
 A helper function to compute if the input is a power of two.
 
bool validateFFTWindowFunction (UINT fftWindowFunction)
 
- Protected Member Functions inherited from FeatureExtraction
bool init ()
 
bool saveFeatureExtractionSettingsToFile (std::fstream &file) const
 
bool loadFeatureExtractionSettingsFromFile (std::fstream &file)
 
- Protected Member Functions inherited from MLBase
bool saveBaseSettingsToFile (std::fstream &file) const
 
bool loadBaseSettingsFromFile (std::fstream &file)
 

Protected Attributes

UINT hopSize
 The current hopSize, this sets how often the fft should be computed.
 
UINT dataBufferSize
 Stores how much previous input data is stored in the dataBuffer.
 
UINT fftWindowSize
 Stores the size of the fft (and also the dataBuffer)
 
UINT fftWindowFunction
 The current windowFunction used for the FFT.
 
UINT hopCounter
 Keeps track of how many input samples the FFT has seen.
 
bool computeMagnitude
 Tracks if the magnitude (and power) of the FFT need to be computed.
 
bool computePhase
 Tracks if the phase of the FFT needs to be computed.
 
VectorFloat tempBuffer
 A temporary buffer used to store the input data for the FFT.
 
CircularBuffer< VectorFloatdataBuffer
 A circular buffer used to store the previous M inputs.
 
Vector< FastFourierTransformfft
 A buffer used to store the FFT results.
 
std::map< unsigned int, unsigned int > windowSizeMap
 A map to relate the FFTWindowSize enumerations to actual values.
 
- Protected Attributes inherited from FeatureExtraction
std::string featureExtractionType
 
bool initialized
 
bool featureDataReady
 
VectorFloat featureVector
 
MatrixFloat featureMatrix
 
- Protected Attributes inherited from MLBase
bool trained
 
bool useScaling
 
bool converged
 
DataType inputType
 
DataType outputType
 
BaseType baseType
 
UINT numInputDimensions
 
UINT numOutputDimensions
 
UINT numTrainingIterationsToConverge
 
UINT minNumEpochs
 
UINT maxNumEpochs
 
UINT batchSize
 
UINT validationSetSize
 
UINT numRestarts
 
Float learningRate
 
Float minChange
 
Float rmsTrainingError
 
Float rmsValidationError
 
Float totalSquaredTrainingError
 
Float validationSetAccuracy
 
bool useValidationSet
 
bool randomiseTrainingOrder
 
VectorFloat validationSetPrecision
 
VectorFloat validationSetRecall
 
Random random
 
Vector< TrainingResulttrainingResults
 
TrainingResultsObserverManager trainingResultsObserverManager
 
TestResultsObserverManager testResultsObserverManager
 
TrainingLog trainingLog
 
TestingLog testingLog
 
- Protected Attributes inherited from GRTBase
std::string classId
 Stores the name of the class (e.g., MinDist)
 
DebugLog debugLog
 
ErrorLog errorLog
 
InfoLog infoLog
 
WarningLog warningLog
 

Additional Inherited Members

- Static Protected Member Functions inherited from FeatureExtraction
static StringFeatureExtractionMapgetMap ()
 

Detailed Description

Examples:
FeatureExtractionModules/FFTExample/FFTExample.cpp.

Definition at line 57 of file FFT.h.

Constructor & Destructor Documentation

FFT::FFT ( const UINT  fftWindowSize = 512,
const UINT  hopSize = 1,
const UINT  numDimensions = 1,
const UINT  fftWindowFunction = RECTANGULAR_WINDOW,
const bool  computeMagnitude = true,
const bool  computePhase = true 
)

Constructor, sets the fftWindowSize, hopSize, fftWindowFunction, if the magnitude and phase should be computed during the FFT and the number of dimensions in the input signal.

Parameters
fftWindowSizesets the size of the fft, this should be a power of two. Default fftWindowSize=512
hopSizesets how often the fft should be computed. If the hopSize parameter is set to 1 then the FFT will be computed everytime the classes computeFeatures(...) or computeFFT(...) functions are called. You may not want to compute the FFT of the input signal for every sample however, if this is the case then set the hopSize parameter to N, in which case the FFT will only be computed every N samples on the previous M values, where M is equal to the fftWindowSize. Default hopSize=1
numDimensionsthe dimensionality of the input data to the FFT. Default numDimensions = 1
fftWindowFunctionsets the window function of the FFT. This should be one of the FFTWindowFunctionOptions enumeration values. Default windowFunction=RECTANGULAR_WINDOW
computeMagnitudesets if the magnitude (and power) of the spectrum should be computed on the results of the FFT. Default computeMagnitude=true
computePhasesets if the phase of the spectrum should be computed on the results of the FFT. Default computePhase=true

Definition at line 33 of file FFT.cpp.

FFT::FFT ( const FFT rhs)

Copy Constructor, copies the FFT from the rhs instance to this instance

Parameters
rhsanother instance of the FFT class from which the data will be copied to this instance

Definition at line 46 of file FFT.cpp.

FFT::~FFT ( void  )
virtual

Default Destructor

Definition at line 53 of file FFT.cpp.

Member Function Documentation

bool FFT::clear ( )
virtual

Sets the FeatureExtraction clear function, overwriting the base FeatureExtraction function. This function is called by the GestureRecognitionPipeline when the pipelines main clear() function is called. This function completely clears the FFT setup, you will need to initialize the instance again before you can use it.

Returns
true if the FFT was reset, false otherwise

Reimplemented from FeatureExtraction.

Definition at line 388 of file FFT.cpp.

bool FFT::computeFeatures ( const VectorFloat inputVector)
virtual

Sets the FeatureExtraction computeFeatures function, overwriting the base FeatureExtraction 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 FFT's computeFFT(...) function.

Parameters
inputVectorthe inputVector that should be processed. Must have the same dimensionality as the FeatureExtraction module
Returns
true if the data was processed, false otherwise

Reimplemented from FeatureExtraction.

Definition at line 246 of file FFT.cpp.

bool FFT::computeFeatures ( const MatrixFloat inputMatrix)
virtual

Sets the FeatureExtraction computeFeatures function, overwriting the base FeatureExtraction 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 FFT's computeFFT(...) function.

Parameters
inputMatrixthe inputMatrix that should be processed. Must have the same dimensionality as the FeatureExtraction module
Returns
true if the data was processed, false otherwise

Reimplemented from FeatureExtraction.

Definition at line 250 of file FFT.cpp.

bool FFT::deepCopyFrom ( const FeatureExtraction featureExtraction)
virtual

Sets the FeatureExtraction deepCopyFrom function, overwriting the base FeatureExtraction function. This function is used to deep copy the values from the input pointer to this instance of the FeatureExtraction module. This function is called by the GestureRecognitionPipeline when the user adds a new FeatureExtraction module to the pipeline.

Parameters
featureExtractiona pointer to another instance of an FFT, the values of that instance will be cloned to this instance
Returns
true if the deep copy was successful, false otherwise

Reimplemented from FeatureExtraction.

Definition at line 81 of file FFT.cpp.

bool FFT::getComputeMagnitude ( ) const
inline

Returns if the magnitude (and power) of the FFT spectrum is being computed.

Returns
true if the magnitude (and power) of the FFT spectrum is being computed and if the FFT has been initialized, otherwise false will be returned

Definition at line 252 of file FFT.h.

bool FFT::getComputePhase ( ) const
inline

Returns if the phase of the FFT spectrum is being computed.

Returns
true if the phase of the FFT spectrum is being computed and if the FFT has been initialized, otherwise false will be returned

Definition at line 259 of file FFT.h.

UINT FFT::getDataBufferSize ( ) const

Returns the current dataBufferSize, which is the same as the FFT window size.

Returns
returns the current dataBufferSize value if the FFT has been initialized, otherwise zero will be returned

Definition at line 411 of file FFT.cpp.

Vector< FastFourierTransform > FFT::getFFTResults ( ) const
inline

Returns the FFT results computed from the last FFT of the input signal.

Returns
returns a vector of FastFourierTransform (where the size of the vector is equal to the number of input dimensions for the FFT). An empty vector will be returned if the FFT was not computed
Examples:
FeatureExtractionModules/FFTExample/FFTExample.cpp.

Definition at line 266 of file FFT.h.

Vector< FastFourierTransform >& FFT::getFFTResultsPtr ( )
inline

Returns a pointer to the FFT results computed from the last FFT of the input signal.

Returns
returns a pointer to the vector of FastFourierTransform (where the size of the vector is equal to the number of input dimensions for the FFT). An empty vector will be returned if the FFT was not computed

Definition at line 273 of file FFT.h.

const Vector< FastFourierTransform >& FFT::getFFTResultsPtr ( ) const
inline

Returns a const pointer to the FFT results computed from the last FFT of the input signal.

Returns
returns a const pointer to the vector of FastFourierTransform (where the size of the vector is equal to the number of input dimensions for the FFT). An empty vector will be returned if the FFT was not computed

Definition at line 280 of file FFT.h.

UINT FFT::getFFTWindowFunction ( ) const

Returns the current FFT window function enumeration value.

Returns
returns the current FFT window function value if the FFT has been initialized, otherwise zero will be returned

Definition at line 422 of file FFT.cpp.

UINT FFT::getFFTWindowSize ( ) const

Returns the FFT window size.

Returns
returns the current FFT window size value if the FFT has been initialized, otherwise zero will be returned

Definition at line 416 of file FFT.cpp.

UINT FFT::getHopCounter ( ) const

Returns the current hop counter value.

Returns
returns the current hop counter value if the FFT has been initialized, otherwise zero will be returned

Definition at line 427 of file FFT.cpp.

UINT FFT::getHopSize ( ) const

Returns the current hopSize.

Returns
returns the current hopSize value if the FFT has been initialized, otherwise zero will be returned

Definition at line 406 of file FFT.cpp.

std::string FFT::getId ( )
static

Gets a string that represents the FFT class.

Returns
returns a string containing the ID of this class

Definition at line 28 of file FFT.cpp.

bool FFT::init ( const UINT  fftWindowSize,
const UINT  hopSize = 1,
const UINT  numDimensions = 1,
const UINT  windowFunction = RECTANGULAR_WINDOW,
const bool  computeMagnitude = true,
const bool  computePhase = true,
const DataType  inputType = DATA_TYPE_VECTOR,
const DataType  outputType = DATA_TYPE_VECTOR 
)

Initializes the FFT. Should be called before calling the computeFFT(...) or computeFeatures(...) methods. This function is automatically called by the constructor.

Parameters
fftWindowSizesets the size of the fft, this must be a power of two
hopSizesets how often the fft should be computed. If the hopSize parameter is set to 1 then the FFT will be computed everytime the classes computeFeatures(...) or computeFFT(...) functions are called. You may not want to compute the FFT of the input signal for every sample however, if this is the case then set the hopSize parameter to N, in which case the FFT will only be computed every N samples on the previous M values, where M is equal to the fftWindowSize
numDimensionsthe dimensionality of the input data to the FFT
windowFunctionsets the window function of the FFT. This should be one of the WindowFunctionOptions enumeration values
computeMagnitudesets if the magnitude (and power) of the spectrum should be computed on the results of the FFT
computePhasesets if the phase of the spectrum should be computed on the results of the FFT
inputTypethe input type expected, defaults to DATA_TYPE_VECTOR
outputTypethe output type that can be accessed by users of the module, defaults to DATA_TYPE_VECTOR
Returns
true if the FTT was initialized, false otherwise

Definition at line 185 of file FFT.cpp.

bool FFT::load ( std::fstream &  file)
virtual

This loads the feature extraction settings from a file. This overrides the load function in the FeatureExtraction base class.

Parameters
filea reference to the file to load the settings from
Returns
returns true if the settings were loaded successfully, false otherwise

Reimplemented from MLBase.

Definition at line 124 of file FFT.cpp.

FFT & FFT::operator= ( const FFT rhs)

Sets the equals operator, copies the data from the rhs instance to this instance

Parameters
rhsanother instance of the FFT class from which the data will be copied to this instance
Returns
a reference to this instance of FFT

Definition at line 56 of file FFT.cpp.

bool FFT::reset ( )
virtual

Sets the FeatureExtraction reset function, overwriting the base FeatureExtraction function. This function is called by the GestureRecognitionPipeline when the pipelines main reset() function is called. This function resets the FFT by re-initiliazing the instance.

Returns
true if the FFT was reset, false otherwise

Reimplemented from MLBase.

Definition at line 401 of file FFT.cpp.

bool FFT::save ( std::fstream &  file) const
virtual

This saves the feature extraction settings to a file. This overrides the save function in the FeatureExtraction base class.

Parameters
filea reference to the file to save the settings to
Returns
returns true if the settings were saved successfully, false otherwise

Reimplemented from MLBase.

Definition at line 98 of file FFT.cpp.

bool FFT::setComputeMagnitude ( const bool  computeMagnitude)

Sets if the magnitude (and power) of the FFT spectrum should be computed.

Parameters
computeMagnitudethe new computeMagnitude parameter
Returns
returns true if the computeMagnitude parameter was successfully updated, false otherwise

Definition at line 471 of file FFT.cpp.

bool FFT::setComputePhase ( const bool  computePhase)

Sets if the phase of the FFT spectrum should be computed.

Parameters
computePhasethe new computeMagnitude parameter
Returns
returns true if the computePhase parameter was successfully updated, false otherwise

Definition at line 477 of file FFT.cpp.

bool FFT::setFFTWindowFunction ( const UINT  fftWindowFunction)

Sets the fftWindowFunction parameter, this should be one of the FFTWindowFunctionOptions enumeration values.

Parameters
fftWindowFunctionthe new fftWindowFunction parameter, must be one of the FFTWindowFunctionOptions enumeration values
Returns
returns true if the fftWindowFunction parameter was successfully updated, false otherwise

Definition at line 463 of file FFT.cpp.

bool FFT::setFFTWindowSize ( const UINT  fftWindowSize)

Sets the fftWindowSize parameter, this sets the size of the fft, this must be a power of two. Setting this value will also re-initialize the FFT.

Parameters
fftWindowSizethe new fftWindowSize parameter, this must be a power of two.
Returns
returns true if the fftWindowSize parameter was successfully updated, false otherwise

Definition at line 452 of file FFT.cpp.

bool FFT::setHopSize ( const UINT  hopSize)

Sets the hopSize parameter, this sets how often the fft should be computed. If the hopSize parameter is set to 1 then the FFT will be computed everytime the classes' computeFeatures(...) or computeFFT(...) functions are called. You may not want to compute the FFT of the input signal for every sample however, if this is the case then set the hopSize parameter to N, in which case the FFT will only be computed every N samples on the previous M values, where M is equal to the fftWindowSize. The hopSize must be greater than zero. Setting the hopSize will also reset the hop counter.

Parameters
hopSizethe new hopSize parameter, must be greater than zero
Returns
returns true if the hopSize parameter was successfully updated, false otherwise

Definition at line 442 of file FFT.cpp.

bool FFT::update ( const Float  x)

Computes the FFT of the previous M input samples, where M is the size of the fft window set by the constructor. The FFT of the input will only be computed if the current hop counter value matches the hopSize. This function should only be used if the dimensionality of the FFT has been set to 1.

Parameters
xthe new sample, this will be added to a buffer and the FFT will be computed for the data in the buffer
Returns
true if the FTT was updated successfully, false otherwise
Examples:
FeatureExtractionModules/FFTExample/FFTExample.cpp.

Definition at line 254 of file FFT.cpp.

bool FFT::update ( const VectorFloat x)

Computes the FFT of the previous M input samples, where M is the size of the fft window set by the constructor. The FFT of the input will only be computed if the current hop counter value matches the hopSize. The dimensionality of the input vector must match the number of dimensions for the FFT.

Parameters
xthe new N-dimensional sample, this will be added to a buffer and the FFT will be computed for the data in the buffer
Returns
true if the FTT was updated successfully, false otherwise

Definition at line 269 of file FFT.cpp.

bool FFT::update ( const MatrixFloat x)

Computes the FFT of the previous M input samples, where M is the size of the fft window set by the constructor. The FFT of the input will only be computed if the current hop counter value matches the hopSize. The number of columns in the input matrix must match the number of dimensions for the FFT.

Parameters
xa [M N] matrix, this will be added to a buffer and the FFT will be computed for the data in the buffer
Returns
true if the FTT was updated successfully, false otherwise

Definition at line 327 of file FFT.cpp.


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