Pixels Portraiture

Pixels Portraiture

Midterm for ICM was to develop a project that uses images and pixels. I chose to use camera because you can see the effect instantly and it’s more personal due to the fact that it is your face. I was inspired by pop art works and the main goal was to have fun while learning how to manipulate the pixels. Also I added an interaction to the portrait; when user clicks the mouse the color of the filter changes randomly. You can see the video and the code of the project below:

Pixels Portrait from Danara Sarioglu on Vimeo.


import processing.video.*;

float pixelBrightness;
float pixelR;
float pixelG;
float pixelB;
float newPixelR;
float newPixelG;
float newPixelB;
Capture video;
void setup() {
size(displayWidth, displayHeight);
video= new Capture(this, width, height );
video.start();
}

void draw() {
if (video.available ()) {
video.read();
video.loadPixels();
loadPixels();
for (int x=max (mouseX-150, 0); x<min(mouseX+150, video.width); x++) {
for (int y=max (mouseY-150, 0); y<min(mouseY+150, video.height); y++) {
int thisPixel= (x+ y*video.width);
color ColorFromImage= video.pixels[thisPixel];

pixelBrightness= brightness(ColorFromImage);

if (pixelBrightness<50) {
pixelR= 255;
pixelG= 255;
pixelB= 255;
} else {

pixelR= newPixelR;
pixelG= newPixelG;
pixelB= newPixelB;
}

color newColor= color(pixelR, pixelG, pixelB);
pixels[thisPixel]= newColor;
pixels[thisPixel/2]= newColor;

}
}
updatePixels();

}
}

void mousePressed(){
newPixelR=random(0,200);
newPixelG=random(0,200);
newPixelB=random(0,200);
}