15 Oct
2008
As with most ICM assignments, the basic functions are relatively easy to understand. The challenge is applying them to a more complex project for the homework assignments. I battle with this each week, trying to find an interesting way to implement some of the new things I've learned.
This week I was obsessed with watching CSI: Miami marathons, and so I decided to use this project to pay homage to David Caruso. I created a little program that lets you say any of the pithy lines Horatio Caine is famous for:

Once you do, I set up an audio cue when the mouse is pressed that rewards you with the audio sting that kicks off the opening credits!
This wasn't easy. I spent a ton of time trying to figure out how to crop the video, and I was never actually able to get it how I wanted. My goal was to crop, rotate it and feather the edges so that it better simulated his mouth, but I just couldn't find the resources online to make that happen. I did use the blend feature to try and get the tone of the video to better resemble his skin. Not sure if it worked or not. Finally, I couldn't integrate the mirror code with the crop code, which would have made it easier for users to line their mouths up with the camera.
Here's the code:
import processing.video.*; // get library
PImage img; // delcare image
Capture video; // get video
Movie sound;
void setup()
{
size (265,238);
img = loadImage("david.jpg"); // load image of David Caruso
image (img,0,0,265,238); // set image size
sound = new Movie (this, "sound.wav");
video = new Capture(this,350,350,30); // capture video
video.crop(115,151,70,15); // crop size
}
void captureEvent(Capture video){
video.read();
}
void draw(){
if (video.available()){
video.read();
}
image(video,115,151,70,15); // view cropped video position
blend (img,120,156,75,20,115,151,70,15,ADD); // Blend image and video colors
}
void mousePressed(){
sound.stop();
sound.play();
}