|
@ -2,6 +2,7 @@ |
|
|
|
|
|
|
|
|
//--------------------------------------------------------------
|
|
|
//--------------------------------------------------------------
|
|
|
void ofApp::setup(){ |
|
|
void ofApp::setup(){ |
|
|
|
|
|
ofDisableArbTex(); |
|
|
ofSetFrameRate(24); |
|
|
ofSetFrameRate(24); |
|
|
ofSetVerticalSync(true); |
|
|
ofSetVerticalSync(true); |
|
|
|
|
|
|
|
@ -23,6 +24,8 @@ void ofApp::setup(){ |
|
|
emotion.Setup(modelPath3, false, true); |
|
|
emotion.Setup(modelPath3, false, true); |
|
|
|
|
|
|
|
|
depthToColourShader.load("data/shader/rampShader.vert", "data/shader/rampShader.frag"); |
|
|
depthToColourShader.load("data/shader/rampShader.vert", "data/shader/rampShader.frag"); |
|
|
|
|
|
rampedFbo.allocate(1600, 800, GL_RGB); |
|
|
|
|
|
drawMesh =ofMesh::plane(1600, 800 ); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -60,7 +63,7 @@ void ofApp::update(){ |
|
|
|
|
|
|
|
|
depth.Normalize(output_ptr, num_elements, min_value, max_value); |
|
|
depth.Normalize(output_ptr, num_elements, min_value, max_value); |
|
|
|
|
|
|
|
|
depth.DataToFbo(output_ptr, 518, 518, fbo, depthToColourShader); |
|
|
depth.DataToFbo(output_ptr, 518, 518, fbo); |
|
|
|
|
|
|
|
|
auto output_tensors_face = yolo.Run(map.fboImage); |
|
|
auto output_tensors_face = yolo.Run(map.fboImage); |
|
|
|
|
|
|
|
@ -110,10 +113,27 @@ void ofApp::update(){ |
|
|
|
|
|
|
|
|
//--------------------------------------------------------------
|
|
|
//--------------------------------------------------------------
|
|
|
void ofApp::draw(){ |
|
|
void ofApp::draw(){ |
|
|
|
|
|
|
|
|
map.Draw(); |
|
|
map.Draw(); |
|
|
|
|
|
//fbo.draw(0, 0);
|
|
|
fbo.draw(0, 0); |
|
|
|
|
|
|
|
|
auto& texCoords = drawMesh.getTexCoords(); |
|
|
|
|
|
auto& tex = rampedFbo.getTexture(); |
|
|
|
|
|
for( auto& tc : texCoords ){ |
|
|
|
|
|
tc = rampedFbo.getTexture().getCoordFromPercent(tc.x, (1.0-tc.y)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
rampedFbo.begin(); |
|
|
|
|
|
depthToColourShader.begin(); |
|
|
|
|
|
depthToColourShader.setUniformTexture("alphaTex", fbo.getTexture(), 0); |
|
|
|
|
|
ofPushMatrix(); |
|
|
|
|
|
// translate to center of window because ofMesh::plane origin is in the center //
|
|
|
|
|
|
ofTranslate(ofGetWidth()/2, ofGetHeight()/2 ); |
|
|
|
|
|
drawMesh.draw(); |
|
|
|
|
|
ofPopMatrix(); |
|
|
|
|
|
depthToColourShader.end(); |
|
|
|
|
|
rampedFbo.end(); |
|
|
|
|
|
|
|
|
|
|
|
rampedFbo.draw(0, 0); |
|
|
|
|
|
|
|
|
if(!firstRun){ |
|
|
if(!firstRun){ |
|
|
faceDetector.DrawBox(detected_faces); |
|
|
faceDetector.DrawBox(detected_faces); |
|
|