Sarah Keeling; FaceOSC

by sarah @ 5:04 am 24 January 2012

For my FaceOSC project I wanted to do something that interacted with video. I thought it could be an interesting experience if while you were watching a movie, your facial reactions in response to the movie affected how it played. My version is a bit glitchy and there are some parts commented out that I would really have liked to get working. So far what I have is: the location of the “face” controls the speed and direction which the video is played back, opening the mouth draws a rectangle of color over the entire screen from a pixel from the movie file and by raising the eyebrows the movie is paused. (Unfortunately this is really hard to see on the video but it does work!) I found a really interesting piece of code on the Processing Forums that was using incoming video stream and mousePressed to ripple the video and was hoping to get this same effect by blinking the eyes, but I’m still working on getting this part running. Also, I was trying to get other clips to works such as the the famous shower scene from “Psycho”, but I’m still working on them too.

Sorry, the second link is a bit long (and crappy) but it shows the mouth variables.

//SarahKeeling's FaceOSC project for Golan Levin's IACD, CMU Spring 2012
// a template for receiving face tracking osc messages from
// Kyle McDonald's FaceOSC https://github.com/kylemcdonald/ofxFaceTracker
//
// this example includes a class to abstract the Face data
//
// 2012 Dan Wilcox danomatika.com
// for the IACD Spring 2012 class at the CMU School of Art
//
// adapted from from Greg Borenstein's 2011 example
// http://www.gregborenstein.com/
// https://gist.github.com/1603230
//

import processing.video.*;
Movie myMovie;

import oscP5.*;
OscP5 oscP5;

// our FaceOSC tracked face dat
Face face = new Face();

void setup() {
  size(600, 600);
  frameRate(30);

  oscP5 = new OscP5(this, 8338);

  //myMovie =new Movie (this, "lenlye_colourbox.mov");
  //myMovie =new Movie (this, "testVid.mov");
  //myMovie =new Movie (this, "psycho_showerscene_evensmaller.mov");
  //myMovie =new Movie (this, "vimeo_abstract_sm.mov");
  //myMovie =new Movie (this, "NotWhatIPaidFor.mov");

  myMovie.play ();

  loadPixels ();
  myMovie.loadPixels ();
}

void draw() {  
  background(255);

  image (myMovie, 0, 0);

  float newSpeed = map (face.posePosition.x, 0, 600, -1.0, 2.0);

  myMovie.speed (newSpeed);

  if (face.eyebrowLeft > 8.4) {
    myMovie.pause ();
  }
  else {
    myMovie.play ();
  }

  if (face.mouthHeight > 2) {
    int col;
    col = myMovie.get (50, 50);
    noStroke ();
    fill (col);
    rect (20, 20, myMovie.width, myMovie.height);
  }


  /*
  if(face.found > 0) {
   translate(face.posePosition.x, face.posePosition.y);
   scale(face.poseScale);
   noFill();
   ellipse(-20, face.eyeLeft * -9, 20, 7);
   ellipse(20, face.eyeRight * -9, 20, 7);
   ellipse(0, 20, face.mouthWidth* 3, face.mouthHeight * 3);
   ellipse(-5, face.nostrils * -1, 7, 3);
   ellipse(5, face.nostrils * -1, 7, 3);
   rectMode(CENTER);
   fill(0);
   rect(-20, face.eyebrowLeft * -5, 25, 5);
   rect(20, face.eyebrowRight * -5, 25, 5);
   */
  print(face.toString());
}


// OSC CALLBACK FUNCTIONS

void oscEvent(OscMessage m) {
  face.parseOSC(m);
}

void movieEvent (Movie m) {
  m.read ();
}

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2024 Interactive Art and Computational Design, Spring 2012 | powered by WordPress with Barecity