Moshe Ladanga

Exposure through the Negative

leave a comment »

Sometimes, the most simple means is the first thing we ignore. We go about our modern complexificatitons, trying to make something more interesting or at least appear more valuable by adding and multiplying functions to something already interesting on its own. This is one of the most important things I learned in developing my project.

For a period I had these experiments in Processing where the image acquired a very hard edge.

*Please click on the images to see in full

**To see it in action, copy code into Processing sketch and run it; make sure the computer is connected to a webcam

Neg Pos Slow with Lines:

import processing.video.*;

Capture video;

void setup() {
size(640, 480); // Change size to 320 x 240 if too slow at 640 x 480
// Uses the default video input, see the reference if this causes an error
video = new Capture(this, 640, 480, 30);
}

void draw() {
if (video.available()) {
video.read();
image(video, 0, 0, 640,480);
loadPixels();

float invertFactor = 255.0;
for (int i=0; i<pixels.length; i++){
float r= abs(red(pixels[i])-invertFactor);
float g= abs(green(pixels[i])-invertFactor);
float b= abs(blue(pixels[i])-invertFactor);
float a= abs(alpha(pixels[i])-invertFactor);
pixels[i]=color(r,g,b,millis()%a);
if( i>0 && i% width==0){
float wave = millis()%100000;
invertFactor-=50000/wave;
}

}
}
updatePixels();
filter(GRAY);
filter(INVERT);

fill(255,0);
rect(0,0,640,480);
smooth();
}

Neg Pos Slow with Lines 02:


import processing.video.*;

Capture video;

void setup() {
size(640, 480); // Change size to 320 x 240 if too slow at 640 x 480
// Uses the default video input, see the reference if this causes an error
video = new Capture(this, 640, 480, 30);
}

void draw() {
if (video.available()) {
video.read();
image(video, 0, 0, 640,480);
loadPixels();

float invertFactor = 255.0;
for (int i=0; i<pixels.length; i++){
float r= abs(red(pixels[i])-invertFactor);
float g= abs(green(pixels[i])-invertFactor);
float b= abs(blue(pixels[i])-invertFactor);
float a= abs(alpha(pixels[i])-invertFactor);
pixels[i]=color(r,g,b,millis()/a);
if( i>0 && i% width==0){
float wave = millis()%100000;
invertFactor-=50000/wave;
}

}
}
updatePixels();
filter(GRAY);
filter(INVERT);

fill(255,0);
rect(0,0,640,480);
smooth();
}

– Then I returned to a sketch I made earlier, something that I at first wasn’t so happy about because I felt the code was too simple. But the thing is, the resulting moving image says something more than those above. (Thanks to Katrin and also to Nikolas, Shazzy and Zai for their encouragement 🙂 ).

import processing.video.*;

Capture video;

void setup() {
size(640, 480); // Change size to 320 x 240 if too slow at 640 x 480
// Uses the default video input, see the reference if this causes an error
video = new Capture(this, 640, 480, 30);
smooth();
}

void draw() {
if (video.available()) {
video.read();
image(video, 0, 0, 640,480);
loadPixels();
float invertFactor = 255.0;

for (int i=0; i<pixels.length; i++){
color colorSum= pixels[i];
int asum = (colorSum >> 24) & 0xFF;
int rsum = (colorSum >> 16) & 0xFF;
int gsum = (colorSum >> 8 ) & 0xFF;
int bsum = colorSum & 0xFF;

int r= int(abs(rsum-invertFactor));
int g= int(abs(gsum-invertFactor));
int b= int(abs(bsum-invertFactor));
int a= int(abs(asum-invertFactor));

pixels[i]=(a<<24)|(r<<16)|(g<<8)|b;
if (i>0 && i% width==0) {

float wave =sin(pixels[i]);
invertFactor-=(255.0/width*wave);
}
}
}
updatePixels();
filter(INVERT);
filter(THRESHOLD,0.9);

}

-Again, thanks to Katrin for the latest version above; she converted parts of my code into bitwise operations to make it run faster:)

Advertisements

Written by mosheladanga

June 15, 2008 at 7:45 PM

Posted in Reflections

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

%d bloggers like this: