How reassemble your face
in
Core Library Questions
•
2 years ago
Hello World,
I'm trying to complete this exercise for a university project but I can't finish it on my own. Could you help me? I'll try to explain what i would get in the final result:
opening this sketch you'll see the image from the web cam, and just clicking randomly take snapshots of a small section of the screen; What I want to do is to control and move these sessions on the screen. Than i want to create a different level (a white screen) in order to recombine these snapshots in a different way for reconstruct a face. I hope that is understandable,
so this is the sketch. Thanks!
/////////////////////////////////////////////////////////////
import processing.video.*;
//Capture myCapture;
PGraphics layer;
PImage flip;
PImage myCapture;
//float rot = 0.0;
//boolean flippato = false;
/////////////////////////////////////////////////////////////
void setup() {
size(800, 600);
//println(Capture.list());
myCapture = new Capture(this, 800, 600);
layer = createGraphics(width, height, P2D);
smooth();
flip = createImage(width, height, RGB);
}
/////////////////////////////////////////////////////////////
void draw() {
image(myCapture, 0, 0);
image(flipImage(myCapture),0,0);
image(layer,0,0);
}
/////////////////////////////////////////////////////////////
void mousePressed() {
//for(int i=0; i<100; i++);
//float r = random(50);
float value = 5;
float m1 = floor (map(value, 0, height, random(10, 50),0));
float m2 = floor (map(value, 0, width, 0,random(10, 50)));
int h = int(random(10,100));
int l = int(random(10,100));
int x = floor (random (myCapture.width-h));
int y = floor (random (myCapture.height-l));
PImage img = flipImage(myCapture).get(x, y, l, h);
layer.beginDraw();
layer.image(img, x, y);
layer.endDraw();
}
//////////////////////////////////////////
void keyPressed() {
if (key == ' ') layer = createGraphics(width, height, P2D);
}
/////////////////////////////////////////
void captureEvent(Capture myCapture) {
myCapture.read();
}
/////////////////////////////////////////////////////////////
I'm trying to complete this exercise for a university project but I can't finish it on my own. Could you help me? I'll try to explain what i would get in the final result:
opening this sketch you'll see the image from the web cam, and just clicking randomly take snapshots of a small section of the screen; What I want to do is to control and move these sessions on the screen. Than i want to create a different level (a white screen) in order to recombine these snapshots in a different way for reconstruct a face. I hope that is understandable,
so this is the sketch. Thanks!
/////////////////////////////////////////////////////////////
import processing.video.*;
//Capture myCapture;
PGraphics layer;
PImage flip;
PImage myCapture;
//float rot = 0.0;
//boolean flippato = false;
/////////////////////////////////////////////////////////////
void setup() {
size(800, 600);
//println(Capture.list());
myCapture = new Capture(this, 800, 600);
layer = createGraphics(width, height, P2D);
smooth();
flip = createImage(width, height, RGB);
}
/////////////////////////////////////////////////////////////
void draw() {
image(myCapture, 0, 0);
image(flipImage(myCapture),0,0);
image(layer,0,0);
}
/////////////////////////////////////////////////////////////
void mousePressed() {
//for(int i=0; i<100; i++);
//float r = random(50);
float value = 5;
float m1 = floor (map(value, 0, height, random(10, 50),0));
float m2 = floor (map(value, 0, width, 0,random(10, 50)));
int h = int(random(10,100));
int l = int(random(10,100));
int x = floor (random (myCapture.width-h));
int y = floor (random (myCapture.height-l));
PImage img = flipImage(myCapture).get(x, y, l, h);
layer.beginDraw();
layer.image(img, x, y);
layer.endDraw();
}
//////////////////////////////////////////
void keyPressed() {
if (key == ' ') layer = createGraphics(width, height, P2D);
}
/////////////////////////////////////////
void captureEvent(Capture myCapture) {
myCapture.read();
}
/////////////////////////////////////////////////////////////
1