Skip to content
Browse files

cleaned expression example

  • Loading branch information...
1 parent ebdd694 commit f76568973f07f0558f1b1c9fffb4d27c66dcd9cd @kylemcdonald committed
Showing with 6 additions and 29 deletions.
  1. +6 −27 example-expression/src/testApp.cpp
  2. +0 −2 example-expression/src/testApp.h
View
33 example-expression/src/testApp.cpp
@@ -9,11 +9,6 @@ void testApp::setup() {
tracker.setup();
tracker.setRescale(.5);
-
- addExpression = false;
- addSample = false;
- saveData = false;
- loadData = false;
}
void testApp::update() {
@@ -21,22 +16,6 @@ void testApp::update() {
if(cam.isFrameNew()) {
if(tracker.update(toCv(cam))) {
classifier.classify(tracker);
- if(addExpression) {
- addExpression = false;
- classifier.addExpression();
- }
- if(addSample) {
- addSample = false;
- classifier.addSample(tracker);
- }
- if(loadData) {
- loadData = false;
- classifier.load("expressions");
- }
- if(saveData) {
- saveData = false;
- classifier.save("expressions");
- }
}
}
}
@@ -63,14 +42,14 @@ void testApp::draw() {
ofPopStyle();
ofDrawBitmapString(ofToString((int) ofGetFrameRate()), ofGetWidth() - 20, ofGetHeight() - 10);
- ofDrawBitmapString(
+ drawHighlightString(
string() +
"r - reset\n" +
"e - add expression\n" +
"a - add sample\n" +
"s - save expressions\n"
"l - load expressions",
- 14, ofGetHeight() - 6 * 12);
+ 14, ofGetHeight() - 7 * 12);
}
void testApp::keyPressed(int key) {
@@ -79,15 +58,15 @@ void testApp::keyPressed(int key) {
classifier.reset();
}
if(key == 'e') {
- addExpression = true;
+ classifier.addExpression();
}
if(key == 'a') {
- addSample = true;
+ classifier.addSample(tracker);
}
if(key == 's') {
- saveData = true;
+ classifier.save("expressions");
}
if(key == 'l') {
- loadData = true;
+ classifier.load("expressions");
}
}
View
2 example-expression/src/testApp.h
@@ -13,6 +13,4 @@ class testApp : public ofBaseApp {
ofVideoGrabber cam;
ofxFaceTracker tracker;
ExpressionClassifier classifier;
-
- bool addExpression, addSample, saveData, loadData;
};

0 comments on commit f765689

Please sign in to comment.
Something went wrong with that request. Please try again.