I'm starting to experiment with using video capture from a built-in device, pretty much trying to build my own version of the ColorSorting example inside Processing (or here:
http://processing.org/learning/libraries/colorsorting.html), but my sketch seems to be devouring my CPU to the point that it's unusable.
My code is below, and as you can see i'm only reading pixels from the webcam, not even drawing them, yet my sketch is too hard to run, whereas the ColorSorting example and other video examples that seem to do much more run fine.
Any ideas! I amaze myself with how quickly I am able to break a basic example!
Code:import processing.video.*;
Capture cam;
void setup() {
size(320, 240, P2D);
frameRate(10);
cam = new Capture(this, 320, 240);
}
void draw() {
if (cam.available() == true) {
cam.read();
cam.loadPixels();//load's new camera frame.
for(int a=0; a<cam.width; a++){//loop through all horizontal pixels.
for(int b=0; b<cam.height; b++){//loop through all vertical pixels.
println(a+" "+b);
}//end of vertical pixels loop.
}//end of horizontal pixels loop.
delay(2000);
}//end of if video exists.
}//end of draw.