Ejemplo n.º 1
0
	void update() {
		cam.update();
		if(cam.isFrameNew()) {
			Mat camMat = toCv(cam);
			tracker.update(camMat);
			trackerDataSave.load(tracker);
		}
	}
Ejemplo n.º 2
0
	void draw() {
		ofSetColor(255);
		cam.draw(0, 0);
		tracker.draw();
		glPointSize(4);
		ofSetColor(ofColor::red);
		trackerDataSave.draw();
		ofSetColor(ofColor::blue);
		trackerDataLoad.draw();
	}
Ejemplo n.º 3
0
void expressionManager::update(ofxFaceTracker & tracker){
	
	if (tracker.getFound()){
		
		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");
		}
	}
	
}
Ejemplo n.º 4
0
void FaceOsc::sendFaceOsc(ofxFaceTracker& tracker) {
    clearBundle();
    
    if(tracker.getFound()) {
        addMessage("/found", 1);
        
        if(bIncludePose) {
            ofVec2f position = tracker.getPosition();
            addMessage("/pose/position", position);
            addMessage("/pose/scale", tracker.getScale());
            ofVec3f orientation = tracker.getOrientation();
            addMessage("/pose/orientation", orientation);
        }
        
        if (bIncludeGestures) {
            addMessage("/gesture/mouth/width", tracker.getGesture(ofxFaceTracker::MOUTH_WIDTH));
            addMessage("/gesture/mouth/height", tracker.getGesture(ofxFaceTracker::MOUTH_HEIGHT));
            addMessage("/gesture/eyebrow/left", tracker.getGesture(ofxFaceTracker::LEFT_EYEBROW_HEIGHT));
            addMessage("/gesture/eyebrow/right", tracker.getGesture(ofxFaceTracker::RIGHT_EYEBROW_HEIGHT));
            addMessage("/gesture/eye/left", tracker.getGesture(ofxFaceTracker::LEFT_EYE_OPENNESS));
            addMessage("/gesture/eye/right", tracker.getGesture(ofxFaceTracker::RIGHT_EYE_OPENNESS));
            addMessage("/gesture/jaw", tracker.getGesture(ofxFaceTracker::JAW_OPENNESS));
            addMessage("/gesture/nostrils", tracker.getGesture(ofxFaceTracker::NOSTRIL_FLARE));
        }
        
        if(bIncludeAllVertices){
            ofVec2f center = tracker.getPosition();
            ofxOscMessage msg;
            msg.setAddress("/raw");
            for(ofVec2f p : tracker.getImagePoints()) {
                if (bNormalizeRaw) {
                    msg.addFloatArg((p.x-center.x)/tracker.getScale());
                    msg.addFloatArg((p.y-center.y)/tracker.getScale());
                }
                else {
                    msg.addFloatArg(p.x);
                    msg.addFloatArg(p.y);
                }
            }
            bundle.addMessage(msg);
        }

    } else {
        addMessage("/found", 0);
    }
    
    sendBundle();
}
Ejemplo n.º 5
0
	void setup() {
		useSharedData();
		tracker.setup();
		cam.initGrabber(1280, 720);
	}
Ejemplo n.º 6
0
void FaceOsc::sendFaceOsc(ofxFaceTracker& tracker) {
    clearBundle();

    if(tracker.getFound()) {
        addMessage("/found", 1);

        ofVec2f position = tracker.getPosition();
        addMessage("/pose/position", position);
        addMessage("/pose/scale", tracker.getScale());
        ofVec3f orientation = tracker.getOrientation();
        addMessage("/pose/orientation", orientation);

        addMessage("/gesture/mouth/width", tracker.getGesture(ofxFaceTracker::MOUTH_WIDTH));
        addMessage("/gesture/mouth/height", tracker.getGesture(ofxFaceTracker::MOUTH_HEIGHT));
        addMessage("/gesture/eyebrow/left", tracker.getGesture(ofxFaceTracker::LEFT_EYEBROW_HEIGHT));
        addMessage("/gesture/eyebrow/right", tracker.getGesture(ofxFaceTracker::RIGHT_EYEBROW_HEIGHT));
        addMessage("/gesture/eye/left", tracker.getGesture(ofxFaceTracker::LEFT_EYE_OPENNESS));
        addMessage("/gesture/eye/right", tracker.getGesture(ofxFaceTracker::RIGHT_EYE_OPENNESS));
        addMessage("/gesture/jaw", tracker.getGesture(ofxFaceTracker::JAW_OPENNESS));
        addMessage("/gesture/nostrils", tracker.getGesture(ofxFaceTracker::NOSTRIL_FLARE));
    } else {
        addMessage("/found", 0);
    }

    sendBundle();
}
Ejemplo n.º 7
0
void testApp::drawNormalized(ofxFaceTracker& tracker) {
	ofClear(0, 0);
	ofMesh mesh = tracker.getMeanObjectMesh();
	normalizeMesh(mesh);	
	mesh.draw();
}