The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, C++ machine learning library designed for real-time gesture recognition.
//Setup a custom recognition pipeline
GestureRecognitionPipeline pipeline;
//Add a low pass filter to the pipeline with a buffer size of 5 samples
pipeline << MovingAverageFilter( 5 );
//Add a 512-sized fast Fourier transform to the pipeline for some feature extraction
pipeline << FFT( 512 );
//Add a custom feature extraction algorithm that will use the output of the FFT as input
pipeline << MyCustomFeatureAlgorithm();
//Add a Random Forest Classifier
pipeline << RandomForest();
//Load a labeled data set from a CSV file and train a classification model
ClassificationData trainingData;
trainingData.load( "TrainingData.csv" );
bool success = pipeline.train( trainingData );
cout << "Test Accuracy: " << pipeline.getTestAccuracy() << endl;
//The following lines would be called each time the user gets a new sample
VectorFloat sample = getDataFromSenor(); //Custom user function
//Pass the sensor data down the pipeline
pipeline.predict( sample );
//Get the predicted class label and likelihood
unsigned int predictedClassLabel = pipeline.getPredictedClassLabel();
Float maxLikelihood = pipeline.getMaximumLikelihood();