Hello, I'm writing a SlitScan that works a little differently than the example that comes with processing.
I want to take the current display window, and shift the whole thing one pixel to the right (dropping off the rightmost column of pixels). Then take a fresh column of pixels from the webcam, set those pixels as the leftmost pixel column in the display window, and repeat.
So the fresh pixels will always be coming from the leftmost edge of the display window, and the older slices of video will trail off the right side of the frame.
The code that I have ends up just smearing the column of pixels out. It does look like the leftmost pixel column is different than the rest of the pixels.
import processing.video.*;
Capture video;
int output_w=640;
int output_h=480;
void setup() {
size(output_w, output_h);
video = new Capture(this,output_w, output_h);
video.start();
background(128);
}
void draw() {
if (video.available()) {
video.read();
video.loadPixels();
loadPixels();
//move the current display window image over by one pixel to the right.
//dropping the rightmost pixel column
for (int x = 0; x < output_w-1; x++){
for (int y = 0; y < output_h; y++){
pixels[x+1+y*output_w] = pixels[x+y*output_w];
}
}
//replace the leftmost pixel column with a fresh pixel column from the webcam