Michael

27 Jan 2013

Punctuation Rain from Mike Taylor on Vimeo.

This is a basic reimplementation of Text Rain by Camille Utterback and Romy Achituv.  The Processing code is relatively efficient as it extracts brightness values directly from the camera pixels that have already been written to the screen.  It also only examines pixels at the current location of the falling letters, rather than performing operations over the entire image.  As with most simple implementations, the app relies on a light-colored background to work properly.  The letters fall at a speed proportional to the brightness difference between the pixel and the light/dark threshold.  Below that threshold, the letters rise until finding a light region again, resulting in the apparent tendency of the letters to “ride” arms and other moving objects.  Additional techniques like background subtraction or true boundary detection could improve performance.

The Processing code can be found here.

And here:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import processing.video.*;
 
Capture cam;
 
int xp = 1;
char ch;
int spacing = 30;
 
//String str = "***************************************";
String str = "!@#$%^&*(^%$##$(#@@#$%&!@#$%^&^%$)%#^&*";
int[] chary = new int[str.length()];
 
void setup() {
size(1280,720);
 
textSize(32);
 
for(int i=0; i<chary.length; i++){
chary[i]=0;
}
 
String[] cameras = Capture.list();
 
if (cameras.length == 0) {
println("There are no cameras available for capture.");
exit();
} else {
println("Available cameras:");
for (int i = 0; i < cameras.length; i++) {
println(cameras[i]);
}
 
// The camera can be initialized directly using an 
// element from the array returned by list():
cam = new Capture(this, cameras[0]);
cam.start(); 
} 
}
 
void draw() {
if (cam.available() == true) {
cam.read();
}
image(cam, 0, 0);
// The following does the same, and is faster when just drawing the image
// without any additional resizing, transformations, or tint.
//set(0, 0, cam);
 
for (int i = 0; i < str.length(); i=i+1) {
ch = str.charAt(i);
chary[i]=chary[i]+int((brightness(get((i+1)*spacing,chary[i]))-80)/20);
if((chary[i]>720)||(chary[i]<0)) {
chary[i]=0;
}
fill(0,102,153);
text(ch,(i+1)*spacing,chary[i]);
 
}
 
//println((brightness(get(mouseX,mouseY)))-100);
}

Punctuation Rain