BROCCOLI FAAAACE

i like broccoli
this amuses me

 
  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);
    stroke(0);
  
    if (found > 0) {
      translate(posePosition.x, posePosition.y);
      scale(poseScale);
      noFill();
      PImage broccoli;
      broccoli= loadImage("broccoli .png");
      image(broccoli, mouthWidth-60, eyebrowLeft-mouthHeight-60, 100, 100);
      fill(255);
      strokeWeight(0);
      ellipse(-20, eyeLeft * -9, 10, 10);
      ellipse(20, eyeRight * -9, 10, 10);
     fill (50,205,50);
     ellipse(-20, eyeLeft * -9, 7, 7);
      ellipse(20, eyeRight * -9, 7, 7);
      fill(0);
      ellipse(-20, eyeLeft * -9, 3, 3);
      ellipse(20, eyeRight * -9, 3, 3);
    
       PImage leftBrow;
       leftBrow= loadImage ("Left.png");
       image(leftBrow, -30, eyebrowLeft * -6, 25,5);
       
       PImage rightBrow;
       rightBrow= loadImage ("Right .png");
       image (rightBrow, 15, eyebrowRight * -6, 25, 5);
       
       PImage Mouth;
       Mouth= loadImage ("Mouth.png");
       image (Mouth,-15,15, mouthWidth*3, mouthHeight *3);

   }
  }
  
  // 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;
  }
  
 
  void oscEvent(OscMessage m) {
  
   
    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);
    }
  }

Comments are closed.