Sam Lavery – 13-9-65

by sam @ 12:30 am 24 January 2012
//reproduction of 13-9-65
 
//creates a boolean variable to keep track of when the mouse has been clicked. program creates new iteration with every click
boolean click = true;
 
//creates random number (between 4 and 6) of circles. just a guess based on the original artwork
float numCircle = random(4,6);
 
//variables used for creating arrays
int numLines = 9;
int numVertex = 8;
 
int testWidth = 500;
int testHeight = 500;
 
//x value arrays
float[]x1 = new float[numVertex];
float[]x2 = new float[numVertex];
float[]x3 = new float[numVertex];
float[]x4 = new float[numVertex];
float[]x5 = new float[numVertex];
float[]x6 = new float[numVertex];
float[]x7 = new float[numVertex];
float[]x8 = new float[numVertex];
float[]x9 = new float[numVertex];
 
//y value arrays
float[]y1 = new float[numVertex];
float[]y2 = new float[numVertex];
float[]y3 = new float[numVertex];
float[]y4 = new float[numVertex];
float[]y5 = new float[numVertex];
float[]y6 = new float[numVertex];
float[]y7 = new float[numVertex];
float[]y8 = new float[numVertex];
float[]y9 = new float[numVertex];
 
float[]slope1 = new float[numVertex-1];
float[]slope2 = new float[numVertex-1];
float[]slope3 = new float[numVertex-1];
float[]slope4 = new float[numVertex-1];
float[]slope5 = new float[numVertex-1];
float[]slope6 = new float[numVertex-1];
float[]slope7 = new float[numVertex-1];
float[]slope8 = new float[numVertex-1];
float[]slope9 = new float[numVertex-1];
 
float[]xintercept1 = new float[numVertex];
 
//setup  
 
void setup()
{
  size(testWidth, testHeight);
  background(255);
  smooth();
  noFill();
  stroke(0);
 
}
 
//function to change the state of "click" variable
 
 void mouseClicked()
 {
   click = true;
 }
 
//begin drawing
 
void draw()
{
  if(click)
  {
    background(255);
 
// create border
line(0,0,testWidth-1,0);
line(0,0,0,testHeight-1);
line(testWidth-1,testHeight-1,0,testHeight-1);
line(testWidth-1,testHeight-1,testWidth-1,0);
 
//create x value of vertices
 
      for(int i = 0; i < numVertex; i++)
  {
    x1[i] = (testWidth/numVertex)*i + random(testWidth/numLines, (testWidth/numVertex)*0.25*i);
    x2[i] = (testWidth/numVertex)*i + random(testWidth/numLines, (testWidth/numVertex)*0.25*i);
    x3[i] = (testWidth/numVertex)*i + random(testWidth/numLines, (testWidth/numVertex)*0.25*i);
    x4[i] = (testWidth/numVertex)*i + random(testWidth/numLines, (testWidth/numVertex)*0.25*i);
    x5[i] = (testWidth/numVertex)*i + random(testWidth/numLines, (testWidth/numVertex)*0.25*i);
    x6[i] = (testWidth/numVertex)*i + random(testWidth/numLines, (testWidth/numVertex)*0.25*i);
    x7[i] = (testWidth/numVertex)*i + random(testWidth/numLines, (testWidth/numVertex)*0.25*i);
    x8[i] = (testWidth/numVertex)*i + random(testWidth/numLines, (testWidth/numVertex)*0.25*i);
    x9[i] = (testWidth/numVertex)*i + random(testWidth/numLines, (testWidth/numVertex)*0.25*i);
  }
 
//set first x coordinate to 0 for all lines
 
  x1[0] = 0;
  x2[0] = 0;
  x3[0] = 0;
  x4[0] = 0;
  x5[0] = 0;
  x6[0] = 0;
  x7[0] = 0;
  x8[0] = 0;
  x9[0] = 0;
 
//set last x coordinate to the testWidth
 
  x1[numVertex-1] = testWidth;
  x2[numVertex-1] = testWidth;
  x3[numVertex-1] = testWidth;
  x4[numVertex-1] = testWidth;
  x5[numVertex-1] = testWidth;
  x6[numVertex-1] = testWidth;
  x7[numVertex-1] = testWidth;
  x8[numVertex-1] = testWidth;
  x9[numVertex-1] = testWidth;
 
//create y value of vertices
 
    for(int i = 0; i < numVertex; i++)
  {
    y1[i] = random(0, (testHeight/numLines));
    y2[i] = random(testHeight/numLines, (testHeight/numLines)*2);
    y3[i] = random((testHeight/numLines)*2, (testHeight/numLines)*3);
    y4[i] = random((testHeight/numLines)*3, (testHeight/numLines)*4);
    y5[i] = random((testHeight/numLines)*4, (testHeight/numLines)*5);
    y6[i] = random((testHeight/numLines)*5, (testHeight/numLines)*6);
    y7[i] = random((testHeight/numLines)*6, (testHeight/numLines)*7);
    y8[i] = random((testHeight/numLines)*7, (testHeight/numLines)*8);
    y9[i] = random((testHeight/numLines)*8, (testHeight/numLines)*9);
  }
 
//find slopes
 
  for(int i = 0; i< numVertex-1; i++)
  {
    slope1[i] = (y1[i]- y1[i+1])/(x1[i]-x1[i+1]);
    slope2[i] = (y2[i]- y2[i+1])/(x2[i]-x2[i+1]);
    slope3[i] = (y3[i]- y3[i+1])/(x3[i]-x3[i+1]);
    slope4[i] = (y4[i]- y4[i+1])/(x4[i]-x4[i+1]);
    slope5[i] = (y5[i]- y5[i+1])/(x5[i]-x5[i+1]);
    slope6[i] = (y6[i]- y6[i+1])/(x6[i]-x6[i+1]);
    slope7[i] = (y7[i]- y7[i+1])/(x7[i]-x7[i+1]);
    slope8[i] = (y8[i]- y8[i+1])/(x8[i]-x8[i+1]);
    slope9[i] = (y9[i]- y9[i+1])/(x9[i]-x9[i+1]);
 
  }
 
// draw horizontal lines from coordinates in arrays
 
    for(int i = 0; i< numVertex-1; i++)
    {
 
      line(x1[i],y1[i], x1[i+1],y1[i+1]);
      line(x2[i],y2[i], x2[i+1],y2[i+1]);
      line(x3[i],y3[i], x3[i+1],y3[i+1]);
      line(x4[i],y4[i], x4[i+1],y4[i+1]);
      line(x5[i],y5[i], x5[i+1],y5[i+1]);
      line(x6[i],y6[i], x6[i+1],y6[i+1]);
      line(x7[i],y7[i], x7[i+1],y7[i+1]);
      line(x8[i],y8[i], x8[i+1],y8[i+1]);
      line(x9[i],y9[i], x9[i+1],y9[i+1]);
    }
 
//draw vertical straight lines
 
  for(int i = 0; i< numVertex-1; i++)
  {
  int chance = int(random(1,8));
  int a = int(random(1,40));
  int b = int(random(1,40));
  int c = int(random(1,40));
  int d = int(random(1,40));
 
  if(chance == 1)
  {
  triangle(x1[i], y1[i], x1[i+1], y1[i+1], x2[i], y2[i]);
  triangle(x1[i], y1[i], x2[i+1], y2[i+1], x2[i], y2[i]);
  triangle(x1[i]+a, y1[i]+a*slope1[i], x1[i]+b, y2[i]+b*slope2[i], x2[i], y2[i]);
  triangle(x1[i]+c, y1[i]+c*slope1[i], x1[i]+d, y2[i]+d*slope2[i], x2[i+1], y2[i+1]);
  triangle(x1[i+1], y1[i+1], x1[i]+c, y1[i]+c*slope1[i], x2[i+1], y2[i+1]);
  }
  else if(chance ==3)
  {
 
  line(x1[i] + a, y1[i]+a*slope1[i], x1[i] + a, (y2[i])+a*slope2[i]);
  line(x1[i] + b, y1[i]+b*slope1[i], x1[i] + b, (y2[i])+b*slope2[i]);
  line(x1[i] + c, y1[i]+c*slope1[i], x1[i] + c, (y2[i])+c*slope2[i]);
  line(x1[i] + d, y1[i]+d*slope1[i], x1[i] + d, (y2[i])+d*slope2[i]);
  }
  }
 
  //fill 2
 
    for(int i = 0; i< numVertex-1; i++)
  {
  int chance = int(random(1,8));
  int a = int(random(1,40));
  int b = int(random(1,40));
  int c = int(random(1,40));
  int d = int(random(1,40));
 
  if(chance == 1)
  {
  triangle(x2[i], y2[i], x2[i+1], y2[i+1], x3[i], y3[i]);
  triangle(x2[i], y2[i], x3[i+1], y3[i+1], x3[i], y3[i]);
  triangle(x2[i]+a, y2[i]+a*slope2[i], x2[i]+b, y3[i]+b*slope3[i], x3[i], y3[i]);
  triangle(x2[i]+c, y2[i]+c*slope2[i], x2[i]+d, y3[i]+d*slope3[i], x3[i+1], y3[i+1]);
  triangle(x2[i+1], y2[i+1], x2[i]+c, y2[i]+c*slope2[i], x3[i+1], y3[i+1]);
  }
  else if(chance ==3)
  {
  line(x2[i] + a, y2[i]+a*slope2[i], x2[i] + a, (y3[i])+a*slope3[i]);
  line(x2[i] + b, y2[i]+b*slope2[i], x2[i] + b, (y3[i])+b*slope3[i]);
  line(x2[i] + c, y2[i]+c*slope2[i], x2[i] + c, (y3[i])+c*slope3[i]);
  line(x2[i] + d, y2[i]+d*slope2[i], x2[i] + d, (y3[i])+d*slope3[i]);
  }
  }
 
  //fill 3
 
      for(int i = 0; i< numVertex-1; i++)
  {
  int chance = int(random(1,6));
  int a = int(random(1,40));
  int b = int(random(1,40));
  int c = int(random(1,40));
  int d = int(random(1,40));
 
  if(chance == 1)
  {
  triangle(x3[i], y3[i], x3[i+1], y3[i+1], x4[i], y4[i]);
  triangle(x3[i], y3[i], x4[i+1], y4[i+1], x4[i], y4[i]);
  triangle(x3[i]+a, y3[i]+a*slope3[i], x3[i]+b, y4[i]+b*slope4[i], x4[i], y4[i]);
  triangle(x3[i]+c, y3[i]+c*slope3[i], x3[i]+d, y4[i]+d*slope4[i], x4[i+1], y4[i+1]);
  triangle(x3[i+1], y3[i+1], x3[i]+c, y3[i]+c*slope3[i], x4[i+1], y4[i+1]);
  }
  else if(chance ==3)
  {
  line(x3[i] + a, y3[i]+a*slope3[i], x3[i] + a, (y4[i])+a*slope4[i]);
  line(x3[i] + b, y3[i]+b*slope3[i], x3[i] + b, (y4[i])+b*slope4[i]);
  line(x3[i] + c, y3[i]+c*slope3[i], x3[i] + c, (y4[i])+c*slope4[i]);
  line(x3[i] + d, y3[i]+d*slope3[i], x3[i] + d, (y4[i])+d*slope4[i]);
  }
  }
 
  //fill 4
 
  for(int i = 0; i< numVertex-1; i++)
  {
  int chance = int(random(1,6));
  int a = int(random(1,40));
  int b = int(random(1,40));
  int c = int(random(1,40));
  int d = int(random(1,40));
 
  if(chance == 1)
  {
  triangle(x4[i], y4[i], x4[i+1], y4[i+1], x5[i], y5[i]);
  triangle(x4[i], y4[i], x5[i+1], y5[i+1], x5[i], y5[i]);
  triangle(x4[i]+a, y4[i]+a*slope4[i], x4[i]+b, y5[i]+b*slope5[i], x5[i], y5[i]);
  triangle(x4[i]+c, y4[i]+c*slope4[i], x4[i]+d, y5[i]+d*slope5[i], x5[i+1], y5[i+1]);
  triangle(x4[i+1], y4[i+1], x4[i]+c, y4[i]+c*slope4[i], x5[i+1], y5[i+1]);
  }
  else if(chance ==3)
  {
  line(x4[i] + a, y4[i]+a*slope4[i], x4[i] + a, (y5[i])+a*slope5[i]);
  line(x4[i] + b, y4[i]+b*slope4[i], x4[i] + b, (y5[i])+b*slope5[i]);
  line(x4[i] + c, y4[i]+c*slope4[i], x4[i] + c, (y5[i])+c*slope5[i]);
  line(x4[i] + d, y4[i]+d*slope4[i], x4[i] + d, (y5[i])+d*slope5[i]);
  }
  }
 
  //fill 5
 
  for(int i = 0; i< numVertex-1; i++)
  {
  int chance = int(random(1,6));
  int a = int(random(1,40));
  int b = int(random(1,40));
  int c = int(random(1,40));
  int d = int(random(1,40));
 
  if(chance == 1)
  {
  triangle(x5[i], y5[i], x5[i+1], y5[i+1], x6[i], y6[i]);
  triangle(x5[i], y5[i], x6[i+1], y6[i+1], x6[i], y6[i]);
  triangle(x5[i]+a, y5[i]+a*slope5[i], x5[i]+b, y6[i]+b*slope6[i], x6[i], y6[i]);
  triangle(x5[i]+c, y5[i]+c*slope5[i], x5[i]+d, y6[i]+d*slope6[i], x6[i+1], y6[i+1]);
  triangle(x5[i+1], y5[i+1], x5[i]+c, y5[i]+c*slope5[i], x6[i+1], y6[i+1]);
  }
  else if(chance ==3)
  {
  line(x5[i] + a, y5[i]+a*slope5[i], x5[i] + a, (y6[i])+a*slope6[i]);
  line(x5[i] + b, y5[i]+b*slope5[i], x5[i] + b, (y6[i])+b*slope6[i]);
  line(x5[i] + c, y5[i]+c*slope5[i], x5[i] + c, (y6[i])+c*slope6[i]);
  line(x5[i] + d, y5[i]+d*slope5[i], x5[i] + d, (y6[i])+d*slope6[i]);
  }
  } 
 
  //fill 6
 
  for(int i = 0; i< numVertex-1; i++)
  {
  int chance = int(random(1,6));
  int a = int(random(1,40));
  int b = int(random(1,40));
  int c = int(random(1,40));
  int d = int(random(1,40));
 
  if(chance == 1)
  {
  triangle(x6[i], y6[i], x6[i+1], y6[i+1], x7[i], y7[i]);
  triangle(x6[i], y6[i], x7[i+1], y7[i+1], x7[i], y7[i]);
  triangle(x6[i]+a, y6[i]+a*slope6[i], x6[i]+b, y7[i]+b*slope7[i], x7[i], y7[i]);
  triangle(x6[i]+c, y6[i]+c*slope6[i], x6[i]+d, y7[i]+d*slope7[i], x7[i+1], y7[i+1]);
  triangle(x6[i+1], y6[i+1], x6[i]+c, y6[i]+c*slope6[i], x7[i+1], y7[i+1]);
  }
  else if(chance ==3)
  {
  line(x6[i] + a, y6[i]+a*slope6[i], x6[i] + a, (y7[i])+a*slope7[i]);
  line(x6[i] + b, y6[i]+b*slope6[i], x6[i] + b, (y7[i])+b*slope7[i]);
  line(x6[i] + c, y6[i]+c*slope6[i], x6[i] + c, (y7[i])+c*slope7[i]);
  line(x6[i] + d, y6[i]+d*slope6[i], x6[i] + d, (y7[i])+d*slope7[i]);
  }
  }
  //fill 7
 
  for(int i = 0; i< numVertex-1; i++)
  {
  int chance = int(random(1,6));
  int a = int(random(1,40));
  int b = int(random(1,40));
  int c = int(random(1,40));
  int d = int(random(1,40));
 
  if(chance == 1)
  {
  triangle(x7[i], y7[i], x7[i+1], y7[i+1], x8[i], y8[i]);
  triangle(x7[i], y7[i], x8[i+1], y8[i+1], x8[i], y8[i]);
  triangle(x7[i]+a, y7[i]+a*slope7[i], x7[i]+b, y8[i]+b*slope8[i], x8[i], y8[i]);
  triangle(x7[i]+c, y7[i]+c*slope7[i], x7[i]+d, y8[i]+d*slope8[i], x8[i+1], y8[i+1]);
  triangle(x7[i+1], y7[i+1], x7[i]+c, y7[i]+c*slope7[i], x8[i+1], y8[i+1]);
  }
  else if(chance ==3)
  {
  line(x7[i] + a, y7[i]+a*slope7[i], x7[i] + a, (y8[i])+a*slope8[i]);
  line(x7[i] + b, y7[i]+b*slope7[i], x7[i] + b, (y8[i])+b*slope8[i]);
  line(x7[i] + c, y7[i]+c*slope7[i], x7[i] + c, (y8[i])+c*slope8[i]);
  line(x7[i] + d, y7[i]+d*slope7[i], x7[i] + d, (y8[i])+d*slope8[i]);
  }
  } 
 
  //fill 8
 
  for(int i = 0; i< numVertex-1; i++)
  {
  int chance = int(random(1,6));
  int a = int(random(1,40));
  int b = int(random(1,40));
  int c = int(random(1,40));
  int d = int(random(1,40));
 
  if(chance == 1)
  {
  triangle(x8[i], y8[i], x8[i+1], y8[i+1], x9[i], y9[i]);
  triangle(x8[i], y8[i], x9[i+1], y9[i+1], x9[i], y9[i]);
  triangle(x8[i]+a, y8[i]+a*slope8[i], x8[i]+b, y9[i]+b*slope9[i], x9[i], y9[i]);
  triangle(x8[i]+c, y8[i]+c*slope8[i], x8[i]+d, y9[i]+d*slope9[i], x9[i+1], y9[i+1]);
  triangle(x8[i+1], y8[i+1], x8[i]+c, y8[i]+c*slope8[i], x9[i+1], y9[i+1]);
  }
  else if(chance ==3)
  {
  line(x8[i] + a, y8[i]+a*slope8[i], x8[i] + a, (y9[i])+a*slope9[i]);
  line(x8[i] + b, y8[i]+b*slope8[i], x8[i] + b, (y9[i])+b*slope9[i]);
  line(x8[i] + c, y8[i]+c*slope8[i], x8[i] + c, (y9[i])+c*slope9[i]);
  line(x8[i] + d, y8[i]+d*slope8[i], x8[i] + d, (y9[i])+d*slope9[i]);
 
  }
  }   
 
//circles
 
 for (int i=0; i<numCircle; i++)
  {
 
    float circumfrence = random(10,130);
    ellipse(random(circumfrence, testHeight-circumfrence), random(circumfrence, testHeight-circumfrence), circumfrence, circumfrence);
 
  }
  click = false;
  }
}

SankalpBhatnagar-FaceOSC

by sankalp @ 11:54 pm 23 January 2012

I’m one of those guys who, upon hearing an awesome song played through my speakers, moves his face closer to the screen. I usually find myself doing it when I listen to songs on YouTube. While funny, this habit is not safe, and arguably unhealthy for my eyes. Thus with the help of Face OSC by Kyle McDonald and Dan Wilcox, I made a program that speeds up the rate of the video and thus the rate of the song if I get closer and slows down if I get too far away. Ultimately, this program was created to keep my eyes at a safe distance from my screen, but turned out to be a pretty fun program that explores the possibilities of face tracking technology.

 

[youtube https://www.youtube.com/watch?v=_hTIKV5uENU]

Deren Guler – FaceOSC

by deren @ 11:54 pm

I used applescript in Processing to control different application on my computer through face movements using the Cocoa library in Processing. I tried a few different applications but focused on Powerpoint because a friend of mine asked if I could hack Powerpoint to run through external gestures. I found an applescript handbook for Powerpoint 2004 which was compatible with my version of the program. The complete list of powerpoint commands can be found here
You can look up commands for most programs pretty easily and substitute different actions. I found that the mouth and eyebrow gestures were easiest to work with in terms of limiting the response rate to more dramatic gestures.

 

video coming…

Here is the code for Powerpoint 2004:

//
// a template for receiving face tracking osc messages from
// Kyle McDonald's FaceOSC https://github.com/kylemcdonald/ofxFaceTracker
//
// 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 com.apple.cocoa.foundation.*; // to access applescript
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();
ellipse(-20, eyeLeft * -9, 20, 7);
ellipse(20, eyeRight * -9, 20, 7);
ellipse(0, 20, mouthWidth* 3, mouthHeight * 3);
ellipse(-5, nostrils * -1, 7, 3);
ellipse(5, nostrils * -1, 7, 3);
rectMode(CENTER);
fill(0);
rect(-20, eyebrowLeft * -5, 25, 5);
rect(20, eyebrowRight * -5, 25, 5);
}
 
//some powerpoint commands
if (mouthWidth > 15){
String script = "tell application \"Microsoft PowerPoint\"" +"\n" + "go to next slide slideshow view of slide show window 1" + "\n" + "end tell";
executeScript(script);
}
 
if (mouthWidth < 15){
String script = "tell application \"Microsoft PowerPoint\"" +"\n" + "go to previous slide slideshow view of slide show window 1" + "\n" + "end tell";
executeScript(script);
 
}
 
if (eyebrowLeft > 8){
String script = "tell application \"Microsoft PowerPoint\"" +"\n" + "exit slide show slideshow view of slide show window 1 " + "\n" + "end tell";
executeScript(script);
}
 
if (eyebrowLeft < 6){
String script = "set theView to slide show view of theWindow " + "\n" + "end tell";
executeScript(script);
}
 
}
 
void executeScript(String script) {
NSAppleScript myScript = new NSAppleScript(script);
NSMutableDictionary errors = new NSMutableDictionary();
myScript.execute(errors);
}
 
// 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) {
if(m.isPlugged() == false) {
println("UNPLUGGED: " + m);
}
}

MadelineGannon-3D Wolf Puppet with FaceOSC

by madeline @ 11:37 pm

3D Wolf Puppet

A framework for bringing 3D mesh data from Rhino (via Grasshopper) into Processing_0195.
The mesh from Rhino is exported as .txt files that contain the model’s UNIQUE VERTICES, as well as the ORDERED VERTICES needed to construct each face. .txt are then streamed from the Rhino/GH file into the sketch’s data folder.

This demo uses FaceOSC to control a 3D puppet, using eyebrow and mouth data to modify the ears and jaw. The code synchronizes the movements of your head, mouth, and eyebrows to control the expressions of a tessellated three-dimensional model. The model was first developed in Rhino3D, then translated to the Processing programming environment through Grasshopper, then connected to Kyle McDonald’s FaceOSC app through Oscp5. PeasyCam is also used for navigation.

Pivot points, as well as points to be rotated are specified in Grasshopper, then exported as .txt files to Processing. While the current puppet is highly tessellated, one can begin to create additional faces (and unique vertices) to give the model higher detail.

+ + + + + + + + + + + + + + + + + + +
Inspired by the work of Karolina Sobecka.
+ + + + + + + + + + + + + + + + + + +

Click to download the java project | gh2faceOSC (rhino + grasshopper files are in the data folder)

[vimeo https://vimeo.com/35550605]
**sorry about the weird faces**
____________________________________________________________________________________

Below is a screengrab of my Rhino / Grasshopper setup:

______________________________________________________________________________________

Kaushal Agrawal – FaceOSC

by kaushal @ 10:36 pm

[youtube=https://www.youtube.com/watch?v=30Szotjp8PA&feature=youtu.be]

I used the FaceOSC and OpenFrameworks wrapper to create a dummy Pacman game. The game is driven by mouth height and face orientation parameters returned by faceOSC. As soon as the user opens the mouth, the Pacman is set to move and when the user closes the mouth, Pacman moves forward. The user can only steer the Pacman left or right to the direction of movement by tilting the head in either directions. The tilt of the head is decided by threshold values to ensure correct turning of the character in the game. The original maze from Pacman was reduced to a simple one to reduce complexity and the ghosts were taken out. To make the game interesting, I added a level completion time. A few things that I realized after completing the project was that while its fascinating to see the game controlled by mouth, it can really exhaust you over multiple play session.
Interesting possibilities: Could use pre-recorded videos from interviews, and use that to drive the game and assign them Pacman scores!

Kaushal Agrawal 13-9-65

by kaushal @ 9:59 pm

//Number of rows and coloums in the patterns;
int pRow = 10; 
int pCol = 8;
int[][] pattern = new int[pRow][pCol];
int numXPoints,numYPoints;
PVector[][] gridPoints;
int initX, initY, aWidth, aHeight;
 
void setup(){
  size(600,650);
  background(255);
  smooth();
  numXPoints = pCol+1;
  numYPoints = pRow+1;
  initX = 50; initY = 50; aWidth=500; aHeight=500;
  gridPoints = new PVector[numYPoints][numXPoints];
  noFill();
  rect(initX,initY,aWidth,aHeight);  
 
   //Initialization
  gridPoints[0][0]=new PVector(initX,initY);
  int cellWidth = aWidth/pCol;
  int cellHeight= aHeight/pRow;
 
  //Determining the location of the points for the first row
  for(int j=1;j<numXPoints-1;j++)
    gridPoints[0][j]=new PVector(gridPoints[0][j-1].x+random(cellWidth-(cellWidth/2),cellWidth+(cellWidth/2)),gridPoints[0][j-1].y);
  gridPoints[0][numXPoints-1]=new PVector(initX+aWidth, initY);
 
  //Getting the location of points for the entire Art
  for(int i=1;i<numYPoints;i++){
    if(i==(numYPoints-1))
      gridPoints[i][0]=new PVector(gridPoints[i-1][0].x,initY+aHeight);
    else
      gridPoints[i][0]=new PVector(gridPoints[i-1][0].x,gridPoints[i-1][0].y+random(cellHeight-(cellHeight/4),cellHeight+(cellHeight/4)));
    for(int j=1;j<numXPoints;j++){
 
      int deviation = (int)random(-10,10);
      gridPoints[i][j]=new PVector();
      gridPoints[i][j].x=gridPoints[i-1][j].x;
      if(i==(numYPoints-1))
        gridPoints[i][j].y=gridPoints[i][j-1].y;
      else
        gridPoints[i][j].y=gridPoints[i][j-1].y+deviation;
      line(gridPoints[i][j-1].x,gridPoints[i][j-1].y,gridPoints[i][j].x,gridPoints[i][j].y);
    }
  }
 
  for(int i=0;i<pRow;i++){
    for(int j=0;j<pCol;j++){
      pattern[i][j]=(int)random(0,3);
    }
  }
  noLoop(); 
}
 
 
void draw(){
  for(int m=0;m<pCol;m++){
    int k = 0;
    while(k<pRow){
      int choice = pattern[k][m];
      //LINES
      if(choice == 1){
        int numLines = (int)random(6,17);
        int temp=k;
        for(int l=0;l<numLines;l++){
          float x = random(gridPoints[k+1][m].x, gridPoints[k+1][m+1].x);
          int z;
          for(z=k;z<pRow;z++){
            if(pattern[z][m]==1){
              int i = z+1;
              int j = m+1;
 
              float m1 = (gridPoints[i-1][j].y - gridPoints[i-1][j-1].y)/(gridPoints[i-1][j].x - gridPoints[i-1][j-1].x);
              float m2 = (gridPoints[i][j].y - gridPoints[i][j-1].y)/(gridPoints[i][j].x - gridPoints[i][j-1].x);
              float y2 = m2*(x-gridPoints[i][j].x)+gridPoints[i][j].y;
              float y1 = m1*(x-gridPoints[i-1][j].x)+gridPoints[i-1][j].y;
              line(x,y1,x,y2);
            }
            else{
              temp = z;
              break;
            }
          }
          temp=z;
        }
        k=temp;
      }
 
      //TRIANGLES
      else if(choice == 2){
        int numTriangles = (int)random(5,13);
        for(int l=0;l0){
            float x = random(gridPoints[i-1][j-1].x, gridPoints[i-1][j].x);
            float y = m1*(x-gridPoints[i-1][j].x)+gridPoints[i-1][j].y;
            float x1 = random(gridPoints[i][j-1].x, gridPoints[i][j].x);
            float y1 = m2*(x1-gridPoints[i][j].x)+gridPoints[i][j].y;
            line(x,y,x1,y1);
            float x2 = random(gridPoints[i][j-1].x, gridPoints[i][j].x);
            float y2 = m2*(x2-gridPoints[i][j].x)+gridPoints[i][j].y;
            line(x,y,x2,y2);
          }
 
          //Triangles start from bottom to top
          else{
            float x =  random(gridPoints[i][j-1].x, gridPoints[i][j].x);
            float y = m2*(x-gridPoints[i][j].x)+gridPoints[i][j].y;
            float x1= random(gridPoints[i-1][j-1].x, gridPoints[i-1][j].x);
            float y1 = m1*(x1-gridPoints[i-1][j].x)+gridPoints[i-1][j].y;
            line(x,y,x1,y1);
            float x2= random(gridPoints[i-1][j-1].x, gridPoints[i-1][j].x);
            float y2 = m1*(x2-gridPoints[i-1][j].x)+gridPoints[i-1][j].y;
            line(x,y,x2,y2);
          }
        } 
        k++;
      }
 
      //BLANK
      else
        k++;
    }
  }
 
  //Draw Circles
  int numCircles = (int)random(8,10);
  for(int l=0;l<numCircles;l++){
    float rad = random(5,70);
    float xc = random(initX+rad,(initX+aWidth-rad));
    float yc = random(initY+rad,(initY+aHeight-rad));
    ellipse(xc, yc, rad, rad);  
  }
}

MahvishNagda-13-9-65

by mahvish @ 7:53 pm





 
boolean getProbTrue(float prob){
  if (random(0, 1) <= prob)
    return true; 
  else 
    return false; 
}
 
int getYatX(int x0, int y0, int x1, int y1, int x){
  return y0 + (((x-x0)*(y1-y0))/(x1-x0)); 
}
 
void setup(){
  size(500, 500); 
}
 
void draw(){
 
  // set up for each frame
  background(255); 
  strokeWeight(1); 
  stroke(0); 
 
  // border
  line(0, 0, 0, height); 
  line(width-1, 0, width-1, height); 
  line(0, 0, width, 0); 
  line(0, height-1, width, height-1);  
 
  float loRange = 0.8; 
  float hiRange = 1.2; 
 
  int[] Xs = new int[9];       // stores the X coordinates for grid
  int[][] Ys = new int[9][9];  // stores the Y coordinates for grid
 
  int[][] fills = new int[9][9]; 
 
  int avXi = width/(Xs.length-1);    // average for each X segment
  int avYi = height/(Ys.length-1);   // average for each Y segment
 
  // get the random X coordinates
  Xs[0] = 0; 
  Xs[Xs.length-1] = width; 
  for(int i=1; i < Xs.length-1; i++){
      Xs[i] = Xs[i-1] + (int) random(loRange*avXi, hiRange*avXi); 
  }
 
  // get the random start Y coordinates
  for(int i=0; i < Ys.length; i++){
    int interval = (int) random(loRange*avYi, hiRange*avYi); 
    if(i==0) 
      Ys[i][0] = interval; 
    else
      Ys[i][0] = Ys[i-1][0] + interval; 
  }
 
  // get all other coordinates
  for(int i=0; i < Ys.length; i++){
    for(int j=1; j < Ys[i].length; j++){
      Ys[i][j] = Ys[i][j-1] + (int) random((loRange-1)*avYi, (1-loRange)*avYi); 
    }
  }
 
  // now let's plot these
  for(int i=0; i < Ys.length; i++){
    for(int j=1; j < Ys[i].length; j++){
      line(Xs[j-1], Ys[i][j-1], Xs[j], Ys[i][j]); 
    }
  }
 
  // choose segment fills
  for(int i=0; i < fills.length; i++){
    for(int j=0; j = 1 && fills[i-1][j] != 1 && 
		fills[i-1][j] != 3 && getProbTrue(0.05)){
          fills[i][j] = 2; 
        } 
        // crossed lines filling 1 segment
        else if(getProbTrue(0.35)){
          fills[i][j] = 3; 
        }
      }
 
    }
  }
 
  // lets add vertical lines   
  for(int i=0; i < Ys.length; i++){
    for(int j=1; j  0 && fills[i][j] == 2){
        numSegments = 2; 
      }
 
      if(numSegments > 0){
 
        // how many lines are we drawing 
        int numLines = (int) random(3, 15);
        if( fills[i][j] == 3) // just many more crossed lines 
           numLines *= 2; 
 
        for (int k=0; k  numSegments-1){ 
            Yks = getYatX( Xs[j-1], Ys[i-numSegments][j-1], 
				Xs[j], Ys[i-numSegments][j], Xk ); 
          }
 
          if(i < Ys.length){
            Yke = getYatX( Xs[j-1], Ys[i][j-1], Xs[j], Ys[i][j], Xe ); 
          }
 
          line(Xk, Yks, Xe, Yke);         
        }
      }
    }
  }
 
  // draw circles 
  for(int i=0; i < random(6,10); i++){
    int randX = (int) random(4, width); 
    int randY = (int) random(4, height); 
 
    int minofCorner = min(randX, randY); 
    minofCorner = min(minofCorner, width - randX); 
    minofCorner = min(minofCorner, height - randY); 
 
    int randRadius = (int) random(4, min(minofCorner, 80)); 
 
    noFill(); 
 
    ellipse(randX, randY, randRadius, randRadius); 
  }
 
  delay(1000); 
 
  if (keyPressed == true) {
    saveFrame("line-####.tif"); 
  }
}

Rothera_alex-13-9-65

by alex @ 7:40 pm

ROTHERA_gaunlet1

///Alex Rothera 1/23/12
 
//Interactive Art and Computational Design
 
 
PVector v1, v2, v3, v4, v5, v6, v7;
 
void setup() {
  size(800, 800);
  smooth();
  background(255);
  frameRate(.2);
  stroke(0);
  strokeWeight(1.5);
}
 
void draw() {
  fill(255);
  rect(0, 0, width, height);
  noFill();
  rect(1, 1, width-3, height-3);
  int overallHorz = floor(random(5, 10));  // # overall divisions
  float horizSpacing = height/overallHorz;  //horizontal spacing distance
  int horizDivisions = 8;
 
 
  PVector [] [] gridXY = new PVector[horizDivisions] [overallHorz];  //2D array to hold ref. points
 
  ///GRID CREATION
  ///establish/store x and y
 
  for (int i=0; i<overallHorz; i++) {
    for (int j=0; j<horizDivisions; j++) {
 
      float tempY = (horizSpacing*i) + random(0, 40);
      float tempX;
 
      if (j==0)  
        tempX=0;
      else if (j==(horizDivisions-1))
        tempX=width;
      else {
        tempX = ((width/horizDivisions) * j) + random(-20, 20);
      }
 
      v1 = new PVector(tempX, tempY);
      gridXY [j][i] =  v1;
    }
  }
 
  /////// //drawing lines (from gridXY points)//////////
  for (int m=0; m<overallHorz; m++) {
    for (int n=0; n<horizDivisions-1; n++) {
 
      v2 = new PVector();
      v2 = gridXY[n][m];
 
      v3 = new PVector();
      v3 = gridXY[n+1][m];
 
      line(v2.x, v2.y, v3.x, v3.y);
    }
  }
 
///////// //***drawing zigzags + straights  ***//////////////
 
  for (int y=0; y<overallHorz-1; y++) {       //for EVERY SECTOR
    for (int z=0; z<horizDivisions-1; z++) {
 
      v4 = new PVector(); 
      v5 = new PVector(); 
      v6 = new PVector(); 
      v7 = new PVector();
      v4 = gridXY[z][y];
      v5 = gridXY[z+1][y];
 
      v6 = gridXY[z][y+1];
      v7 = gridXY[z+1][y+1];
 
      float topSLOPE = (v4.y-v5.y)/(v4.x-v5.x);
      float bottomSLOPE = (v6.y-v7.y)/(v6.x-v7.x);
      //mx+b = y;
      float b1 = v4.y - (topSLOPE*v4.x);
      float b2 = v6.y - (bottomSLOPE*v6.x);
 
 
    //////choosing zigzags, straights, or none
      int decision = floor(random(0, 5));  
      //#0
      //*zig zags*// 
      if (decision == 0) {  
        float numSlashes = random(8, 30);
        for (int g=0; g<numSlashes; g++) {
          float newX = (random(v4.x, v5.x));
          float newX2 = (random(v6.x, v7.x));
          float newY = (topSLOPE*newX) + b1;
          float newY2 = (bottomSLOPE*newX2) + b2;
 
          line(newX, newY, newX2, newY2);
        }
      }
      //#1
      //*straight lines*//
      else if (decision == 1) {
        float numLines = random(5, 18);
        for (int h=0; h<numLines; h++) {
          float newX = (random(v4.x, v5.x));
          float newY = (topSLOPE*newX) + b1;
          float newY2 = (bottomSLOPE*newX) + b2;
 
          line(newX, newY, newX, newY2);
        }
      }
 
      //#2
      //*blank area*//
      else {
        //println("*skip*");
      }
    }
  }
 
  /******/  ////CIRCLES////////********///   
 
  int randCircles = floor(random(3, 11));
 
  for (int q=0; q<randCircles; q++) {
    float randRadius = random(2, 150);
    ellipse(random(0, width), random(0, height), randRadius, randRadius);
  }
}

KelseyLee-FaceOSC

by kelsey @ 3:51 am

Using FaceOSC and Processing I wanted to create an interactive visualization showing the person’s movement about the frame. The Processing file parses the data from FaceOSC and focuses in on the mouth height and eyebrow/eye heights. When the mouth is open past a certain threshold, stars are generated on the canvas. Meanwhile, raising the eyebrows will change the color of the stars that are to be generated next. Scale is also taken into account, with the person being closer to the screen resulting in larger stars.

The circle on the canvas indicates where the stars will originate, and maps to the person’s nose position. Each star has a designated “life”, so that eventually they will dissipate, allowing screen space to be freed up, however until then they will bounce about the screen, rebounding off the bounds of the frame.

[youtube=https://www.youtube.com/watch?v=TajOcZieAwI&feature=youtu.be]
In version 2, I instead had a background fill that was partially transparent, allowing the stars’ trails to be evident however, eventually fading out after many semi-opaque layers pile up.
[youtube=https://www.youtube.com/watch?v=YtHuzdiL0dI&feature=youtu.be]

SankalpBhatnagar-13-9-65

by sankalp @ 3:46 am

Hello, this is Part 2 of my Project 1 (Guantlet) where I was to reproduce the 1965 Plotter work, 13/9/65 Nr.2, by Frieder Nake in my own preferred programming enviornment. I chose Processing. Striving for an accurate reproduction definitely took me quite a while. Enjoy!

 

You can take a look at my code below:

void setup()
{
  size(899,935);
  background(255,255,255);
background(255,255,255);
  smooth();
  noFill();
  strokeWeight(2);
}
 
void draw()
{
 
  smooth();
  background(255,255,255);
  drawInitialSquare();
  drawCircles();
 
  //ALL Horizontal Lines
  drawHorizontalLine(20,60,184,43,557,38,620,45,822,24,880,21,880,21,880,21); //first line
  drawHorizontalLine(20,184,191,186,341,200,421,196,585,207,687,178,881,174, 881,174); //second line
  drawHorizontalLine(21,274,184,255,345,266,423,253,584,249,632,262,880,261,880,261); //third line
  drawHorizontalLine(20,349,244,345,436,339,586,323,627,336,690,330,830,340,882,348); //fourth line
  drawHorizontalLine(20,394,186,394,345,379,586,385,629,374,696,378,836,363,881,353); //fifth line
  drawHorizontalLine(20,517,186,516,344,498,426,481,584,478,633,460,689,448,882,450); //sixth line
  drawHorizontalLine(21,575,335,569,426,571,584,564,633,557,688,560,828,545,881,555); //seventh line
  drawHorizontalLine(22,674,204,666,422,657,585,633,628,629,693,627,830,640,882,630); //eighth line
  drawHorizontalLine(23,761,184,753,344,739,426,733,586,742,693,730,823,737,882,734); //ninth line
 
  //ALL Diagonal Clusters
  drawDiagonalsBetween(10,448,16,568,16,448,40,568,39); //between top and first left to right
 
  drawDiagonalsBetween(20,20,60,184,43,20,184,191,186); //between first and second left to right
  drawDiagonalsBetween(10,437,40,579,39,447,197,526,203);
  drawDiagonalsBetween(10, 587, 43, 629, 45, 587, 207, 622, 196);
  drawDiagonalsBetween(20,691,40,880,21,691,178,881,174);
 
  drawDiagonalsBetween(17,587,207,627,197,587,251,627,261); //between second and third left to right
  drawDiagonalsBetween(20,699,178,881,174,699,262,881,261);
 
  drawDiagonalsBetween(30,20,275,181,257,20,348,175,345); //between the third and fourth left to right
  drawDiagonalsBetween(15, 343,267,420,255,343,342,425,339);
  drawDiagonalsBetween(15,468,254,583,249,477,335,576,323);
  drawDiagonalsBetween(30,629,262,688,262,629,336,688,330);
  drawDiagonalsBetween(10,693,263,810,261,715,332,794,338);
 
  drawDiagonalsBetween(20,20,350,170,348,20,394,182,394); //between the fourth and fifth left to right
  drawDiagonalsBetween(20,343,343,420,341,342,378,427,381);
 
  drawDiagonalsBetween(10,346,380,392,381,349,495,426,479);//between the fifth and sixth left to right
  drawDiagonalsBetween(10,630,375,688,379,630,459,688,449);
  drawDiagonalsBetween(20,697,380,827,365,693,448,820,448);
 
  drawDiagonalsBetween(10,195,515,339,500,201,572,338,568);//between the sixth and seventh left to right
  drawDiagonalsBetween(10,349,497,423,482,360,569,421,569);
  drawDiagonalsBetween(20,587,478,629,463,590,563,629,558);
 
  drawDiagonalsBetween(15,21,575,174,573,21,674,130,669);//between the seventh and eigth left to right
  drawDiagonalsBetween(15,337,569,426,572,338,660,427,656);
  drawDiagonalsBetween(20,631,558,693,562,630,628,693,627);
 
  drawDiagonalsBetween(10,235,665,337,661,195,753,329,741);//between the eigth and ninth left to right
  drawDiagonalsBetween(10,453,654,576,634,436,733,582,742);
 
  drawDiagonalsBetween(20,719,733,826,739,701,878,828,876); //between the ninth and bottom
 
  //ALL Vertical Clusters
  drawVerticalsBetween(10,655,42,684,40, 655,262,684,262);  //between first and third lines left to right
 
  drawVerticalsBetween(15,341,200,421,196,341,266,421,253); //between second and third lines left to right
  drawVerticalsBetween(20,20,184,164,186,20,274,164,258);
  drawVerticalsBetween(15,530,204,555,206,530,250,555,249);
 
  drawVerticalsBetween(10,594,326,623,335,494,410,623,374); //between fourth and fifth left to right
  drawVerticalsBetween(20,709,332,828,341,709,376,828,365);
 
  drawVerticalsBetween(30,444,339,532,329,444,479,532,479); //between fourth and sixth left to right
 
  drawVerticalsBetween(10,186,395,229,391,186,514,229,510); //between fifth and sixth left to right
  drawVerticalsBetween(20,256,388,334,381,258,506,334,499);
 
  drawVerticalsBetween(30,834,365,882,353,834,546,882,556);//between fifth and seventh left to right
 
  drawVerticalsBetween(20,201,573,305,571,201,665,305,661); //between seventh and eigth left to right
  drawVerticalsBetween(30,336,570,425,571,336,660,425,657);
  drawVerticalsBetween(30,438,572,579,566,438,654,579,633);
 
  drawVerticalsBetween(15,341,660,427,656,341,738,427,732); //between eigth and ninth left to right
  drawVerticalsBetween(30,704,628,811,639,704,730,811,736);
  drawVerticalsBetween(20,831,640, 882,631,831,735,882,733);
 
  drawVerticalsBetween(10,586,633,628,630,586,877,633,877); //between eighth and bottom left to right
 
  noLoop();
  println("Finished.");
  exit();
}
 
//initial square
void drawInitialSquare()
{
  line(20,20,880,13);
  line(20,20,23,882);
  line(23,882,883,876);
  line(883,876,880,13);
}
 
void drawHorizontalLine(int a, int A, int b, int B, int c, int C, int d, int D, int e, int E, int f, int F, int g, int G, int h, int H)
{
  line(a,A,b,B);
  line(b,B,c,C);
  line(c,C,d,D);
  line(d,D,e,E);
  line(e,E,f,F);
  line(f,F,g,G);
  line(g,G,h,H);
}
 
void drawVerticalsBetween(float n,float a, float A, float b, float B, float c, float C, float d, float D)
{
  for(float i=a; i<b ; i=i+random(1,n))
  {
    float temp1= findY(i,a,A,b,B);
    float temp2= findY(i,c,C,d,D);
    line(i,temp1,i,temp2);
  }
 
}
 
void drawDiagonalsBetween(float n, float a, float A, float b, float B, float c, float C, float d, float D)
{
  for (int i = 0; i < n; i++)
  {
    float x1 = random(a,b);
    float x2 = random(c,d);
    float y1 = findY(x1,a,A,b,B);
    float y2 = findY(x2,c,C,d,D);
    line(x1,y1,x2,y2);
  }
}
 
float findY(float X, float xi, float yi, float xf, float yf)
{
  float s= (yf-yi)/(xf-xi);
  float Y= s*(X-xi)+yi;
  return(Y);
}
 
void drawCircles()
{
  ellipse(69,59.5,39,39);
  ellipse(839,81,66,66);
  ellipse(232,237,83,83);
  ellipse(269,422,44,44);
  ellipse(376,435,128,128);
  ellipse(26,477,6,6);
  ellipse(236,663,131,131);
  ellipse(328,734,42,42);
}
« Previous PageNext Page »
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2023 Interactive Art and Computational Design, Spring 2012 | powered by WordPress with Barecity