SMT Library is a part of OpenMT project.
SMT (Sensibleui's Multi Touch) Library is an ANSI C-based multi-touch algorithm, so to be easily ported to microcontrollers.
With multitouch data provided, it processes the data and outputs touch position, touch ID, and gesture recognition results.
Imagine that you are control a photo with multi-touch. In this case you want to simultaneously rotate and rersize the size of the photo. And your action will produce rotation and resize (scaling) events at a same time instant. This is why SMT sends out multiple events at a single time instant.
This tutorial shows example usage of SMT library. In using SMT, the most important functions are initsmt() and runsmt().
#include <smt.h> void main(void) { // Set and initialize parameters of multi-touch algorithms initsmt(); do { // You should provide a data acquisition code // Touch data SHOULD be stored at mt_sensor_data[] variable your_data_acquisition_routine(mt_sensor_data); // Call SMT for every single frame. runsmt(); // All computing results of SMT library is stored in // TOUCHEVENT EVENTLIST[] variable. // You can directly access it or make your own reporting routine // as follows: your_report_routine(EVENTLIST); } while (1); }
SMTG Library is a part of OpenMT project.
SMTG Library include gesture recognition and interpreter.
void main(void) { do { // Set and initialize parameters of SMTG algorithm when the number of touch is zero. if(the number of touch == 0) InitializeSMTG(); // Call ProcessSMTG for every single frame. ProcessSMTG(); } while (1); }
void main(void) { do { // Set and initialize parameters of SMTG algorithm when the number of touch is zero. if(the number of touch == 0) InitializeSMTG(); // assign variable to save touch values from int id[SG_MAX_TOUCH]; // TUIO compatible monotonically increasing touch ID float fx[SG_MAX_TOUCH]; // x value of touch point. float fy[SG_MAX_TOUCH]; // y value of touch point. float fdx[SG_MAX_TOUCH]; // displacement between current x value of touch point and old x value of it. float fdy[SG_MAX_TOUCH]; // displacement between current y value of touch point and old y value of it. int nBlobsSize = 0; for(int i=0;i<num_touch;i++) // num_touch is the number of current touch. { id[nBlobsSize] = cur_touch->getCursorID(); fx[nBlobsSize] = cur_touch->getX(); fy[nBlobsSize] = cur_touch->getY(); fdx[nBlobsSize] = cur_touch->getXSpeed(); fdy[nBlobsSize] = cur_touch->getYSpeed(); nBlobsSize++; } sgRecognizeGesture(nBlobsSize, id, fx, fy, fdx, fdy); // recognize gesture from touch information. sgInterpreteGesture(MAGIC_MT_TRACKPAD_INTERPRETER); // interpret meaning of gesture from recgnized gesture results. } while (1); }