Interactive Authoring Final

 

import processing.video.*;
import ipcapture.*;
import gab.opencv.*;
import ddf.minim.*;
import ddf.minim.analysis.*;
import java.awt.Rectangle;

Capture cam;
OpenCV opencv;
Rectangle[] Faces;
PImage img1;
PImage img2;
PImage img3;
PImage img4;
PImage img5;
boolean newFrame=false;
int i;

void setup () {
size(800, 600);
cam = new Capture(this, 800, 600);
surface.setResizable(true);
cam.start();
img1 = new PImage(80, 60);
opencv = new OpenCV(this, 800, 600);
opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);

img1 = loadImage(“ice-tissue-forming.jpg”);
img2 = loadImage(“icicle.jpg”);
img3 = loadImage(“warm.jpg”);
img4 = loadImage(“Fire Gif.gif”);
img5 = loadImage(“Sunlight.png”);
}
void captureEvent(Capture cam) {
cam.read();
newFrame = true;
}
void draw () {

cam.loadPixels();
image(cam, 0, 0);
Faces = opencv.detect();
opencv.loadImage(cam);

for (int i = 0; i < Faces.length; i++) {
noStroke();
fill(255, 0, 255, 0);
ellipse(Faces[i].x+100, Faces[i].y+100, Faces[i].width-30, Faces[i].height+40);

if (Faces[i].width <=60){
tint(255,20);
image(img1, 0,0,800,600);
}
if (Faces[i].width >=60 && Faces[i].width <=90){
tint(255,20);
image(img2, 0,0,800,600);
}
if (Faces[i].width >=90 && Faces[i].width <=130){
tint(255,20);
image(img5, 0,0,800,600);
}
if (Faces[i].width >=130 && Faces[i].width <=180){
tint(255,20);
image(img3, 0,0,800,600);
}
if (Faces[i].width >=180){
tint(255,20);
image(img4, 0,0,800,600);
}
}
}

Advertisements
This entry was posted in Non Time Based and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s