Skip to content

Instantly share code, notes, and snippets.

@ktuite
Created June 18, 2014 03:19
Show Gist options
  • Save ktuite/4baf32874e8ed6a7e692 to your computer and use it in GitHub Desktop.
Save ktuite/4baf32874e8ed6a7e692 to your computer and use it in GitHub Desktop.
slit-scan video code from http://www.flong.com/texts/lists/slit_scan/ updated to work with processing 2.2.1
import processing.video.*;
Capture C;
int X=0;
void setup() {
size(640, 480);
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():
C = new Capture(this, cameras[0]);
C.start();
}
}
void draw() {
if (C.available()) {
C.read();
copy(C, (C.width/2),0,1,C.height, (X++%width),0,1,height);
} else {
System.out.println("not avail");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment