For an assignment for school I have to make a program that allows you to morph your face with use of a webcam, by using a bright green handshoe.
For now I have a script for recognizing the green handshoe and a script where you can adjust the color the program needs to follow. the program also returns a number of the place of the pixel the program follows.
So far I understand it. But what I don't know is how I can make the program morph the webcamimage it receives. Can anyone get me started, or tell me which command to use for morphing the image, or has a link to a useful tutorial?
This is what the program should do:
platzak.com/portrait.jpg
and this is the code I have so far:
Code:
import processing.video.*;
Capture myCapture;
color trackColor = color(0,255,0);
int plek = 0;
void setup()
{
size(320 , 240);
myCapture = new Capture(this, width, height, 30);
}
void captureEvent(Capture myCapture) {
myCapture.read();
}
void draw() {
myCapture.loadPixels();
for (int i = 0; i < myCapture.pixels.length; i++) {
if(myCapture.pixels[i] == trackColor) {
plek = i;
}
}
myCapture.updatePixels();
image(myCapture, 0, 0);
fill(trackColor);
rect(10, 10, 10, 10);
println(plek);
}
void mousePressed() {
trackColor = get(mouseX, mouseY);
}
I'm relative new to processing so I have some difficulty understanding all the commands, though I have some experience in writing in actionscript 2.0. I searched the web for some tutorials or something like that, but did not found something useful.
I really hope someone can help me, my diploma depends on it.. ;)