root / src / gesture / GestureCollector.h @ 21
View | Annotate | Download (1.1 KB)
| 1 | /*
|
|---|---|
| 2 | * GestureLearner.h |
| 3 | * |
| 4 | * Sample class implementing comm functionality with MultitouchListener. |
| 5 | * |
| 6 | * Created on: Mar 27, 2009 |
| 7 | * Author: sashikanth |
| 8 | */ |
| 9 | |
| 10 | #ifndef GESTURECOLLECTOR_H_
|
| 11 | #define GESTUREECOLLECTOR_H_
|
| 12 | |
| 13 | #include <iostream> |
| 14 | #include <string.h> |
| 15 | #include <stdio.h> |
| 16 | #include <cstdlib> |
| 17 | |
| 18 | #include "touch/Touch.h" |
| 19 | |
| 20 | class GestureCollector |
| 21 | {
|
| 22 | bool appendFrames;
|
| 23 | public:
|
| 24 | |
| 25 | GestureCollector() |
| 26 | {
|
| 27 | } |
| 28 | ~GestureCollector() |
| 29 | {
|
| 30 | } |
| 31 | GestureSample currSample; |
| 32 | string gestureName; |
| 33 | std::vector<GestureSample> samples; |
| 34 | |
| 35 | void updateFrame(ContactSetFrame c)
|
| 36 | {
|
| 37 | // if(appendFrames)
|
| 38 | // {
|
| 39 | currSample.push_back(c); |
| 40 | // }
|
| 41 | } |
| 42 | |
| 43 | void endSample()
|
| 44 | {
|
| 45 | appendFrames = false;
|
| 46 | samples.push_back(currSample); |
| 47 | cout << "Collected: " << samples.size() << " samples" << endl; |
| 48 | // std::cout << "\n\nPrinting Sample:\n" << std::endl;
|
| 49 | // currSample.printSample();
|
| 50 | } |
| 51 | |
| 52 | void startSample(const char* gestName) |
| 53 | {
|
| 54 | //clear sample and start appending frames
|
| 55 | gestureName = gestName; |
| 56 | currSample.clear(); |
| 57 | appendFrames = true;
|
| 58 | } |
| 59 | |
| 60 | virtual void gestureAction(const char* actionString){} |
| 61 | }; |
| 62 | #endif /* GESTURELEARNER_H_ */ |
