/* linescan: Line-by-line read from video capture hardware. Following Josh Pollen's treatments of hardware scanners - see http://www.mynaughtyleg.com/ Daniel Jones, 2007. http://www.erase.net */ import processing.video.*; Capture video; int y = 0; void setup() { size(640, 480); video = new Capture(this, width, height); frameRate(20); background(0); } void draw() { if (video.available()) { video.read(); video.loadPixels(); loadPixels(); for (int i = 0; i < width; i++) pixels[(y * width) + i] = video.pixels[(y * width) + i]; updatePixels(); video.updatePixels(); y++; if (y == height) { long time = (long) Calendar.getInstance().getTimeInMillis() / 1000; save("out." + time + ".jpg"); y = 0; } } }