DragFace
For this assignment, I remembered that the creator had created something that meshed a celebrity face with your face. I wanted to do something similar but with drag makeup. I attempted this idea but adding eye shadow, large red lips and contoured nose line. However, due to the short time frame, this failed immensely but I do not want to give up on this idea I want to learn more so that I can apply this concept properly. I hess this assignment was just to learn about the basics of this face program.
import oscP5.*;
OscP5 oscP5;
// num faces found
int found;
// pose
float poseScale;
PVector posePosition = new PVector();
PVector poseOrientation = new PVector();
// gesture
float mouthHeight;
float mouthWidth;
float eyeLeft;
float eyeRight;
float eyebrowLeft;
float eyebrowRight;
float jaw;
float nostrils;
void setup() {
size(640, 480);
frameRate(30);
oscP5 = new OscP5(this, 8338);
oscP5.plug(this, "found", "/found");
oscP5.plug(this, "poseScale", "/pose/scale");
oscP5.plug(this, "posePosition", "/pose/position");
oscP5.plug(this, "poseOrientation", "/pose/orientation");
oscP5.plug(this, "mouthWidthReceived", "/gesture/mouth/width");
oscP5.plug(this, "mouthHeightReceived", "/gesture/mouth/height");
oscP5.plug(this, "eyeLeftReceived", "/gesture/eye/left");
oscP5.plug(this, "eyeRightReceived", "/gesture/eye/right");
oscP5.plug(this, "eyebrowLeftReceived", "/gesture/eyebrow/left");
oscP5.plug(this, "eyebrowRightReceived", "/gesture/eyebrow/right");
oscP5.plug(this, "jawReceived", "/gesture/jaw");
oscP5.plug(this, "nostrilsReceived", "/gesture/nostrils");
}
void draw() {
background(255,255,255, 10);
stroke(0);
if(found > 0) {
translate(posePosition.x, posePosition.y);
scale(poseScale);
noFill();
ellipse(-20, eyeLeft * -9, 20, 7);
ellipse(20, eyeRight * -9, 20, 7);
fill(255,0,0, 200);
ellipse(0, 20, mouthWidth* 3, mouthHeight * 7);
fill(255);
ellipse(0, 20, mouthWidth* 3, mouthHeight * 3);
noFill();
ellipse(-5, nostrils * -1, 7, 3);
ellipse(5, nostrils * -1, 7, 3);
line(-5, nostrils * -2, -7, eyebrowLeft*-5);
line(5, nostrils * -2, 7, eyebrowLeft*-5);
noStroke();
rectMode(CENTER);
fill(140,100,40);
rect(-20, eyebrowLeft * -5, 25, 5);
rect(20, eyebrowRight * -5, 25, 5);
noStroke();
fill(90,150,200,150);
ellipse(-20, (eyebrowLeft*-5)+10, 30,eyebrowLeft*2);
ellipse(20, (eyebrowRight*-5)+10, 30,eyebrowRight*2);
fill(10,50,100,150);
ellipse(-30, (eyebrowLeft*-5)+10, 30,eyebrowLeft*2);
ellipse(30, (eyebrowRight*-5)+10, 30,eyebrowRight*2);
}
}
// OSC CALLBACK FUNCTIONS
public void found(int i) {
println("found: " + i);
found = i;
}
public void poseScale(float s) {
println("scale: " + s);
poseScale = s;
}
public void posePosition(float x, float y) {
println("pose position\tX: " + x + " Y: " + y );
posePosition.set(x, y, 0);
}
public void poseOrientation(float x, float y, float z) {
println("pose orientation\tX: " + x + " Y: " + y + " Z: " + z);
poseOrientation.set(x, y, z);
}
public void mouthWidthReceived(float w) {
println("mouth Width: " + w);
mouthWidth = w;
}
public void mouthHeightReceived(float h) {
println("mouth height: " + h);
mouthHeight = h;
}
public void eyeLeftReceived(float f) {
println("eye left: " + f);
eyeLeft = f;
}
public void eyeRightReceived(float f) {
println("eye right: " + f);
eyeRight = f;
}
public void eyebrowLeftReceived(float f) {
println("eyebrow left: " + f);
eyebrowLeft = f;
}
public void eyebrowRightReceived(float f) {
println("eyebrow right: " + f);
eyebrowRight = f;
}
public void jawReceived(float f) {
println("jaw: " + f);
jaw = f;
}
public void nostrilsReceived(float f) {
println("nostrils: " + f);
nostrils = f;
}
// all other OSC messages end up here
void oscEvent(OscMessage m) {
/* print the address pattern and the typetag of the received OscMessage */
println("#received an osc message");
println("Complete message: "+m);
println(" addrpattern: "+m.addrPattern());
println(" typetag: "+m.typetag());
println(" arguments: "+m.arguments()[0].toString());
if(m.isPlugged() == false) {
println("UNPLUGGED: " + m);
}
}