We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi all,
I am capturing video and displaying it on my screen. I am modifying the pixels but it's too taxing on my machine to have it running non-stop. (image every 5 seconds, etc)
How can I set the camera to capture at a set interval?
import processing.video.*;
Capture video;
int fps=30;
void setup() {
  size(1440/2, 900/2); 
  video = new Capture(this, width, height, fps);
  noStroke();
  smooth();
}
void draw() {
  background(0);
  if (video.available()) {    
    video.read();
  }
  video.loadPixels();
  for (int x = 0; x < video.width; x=x+5) {
    for (int y = 0; y < video.height; y=y+5) {
      color c = video.pixels[x+y*video.width];  
      fill(c);
      rect(x, y, 5, 5);
    }
  }
}
Answers
your frame rate for the camera is 30, but processing's draw runs at 60 by default. you could try adding frameRate(30); after your size(); function to sync with your capture fps.
Thanks but what if I want to capture an image from the camera once every 2 minutes?
Then you call video.read() only once per 2 minutes.
Here's your source where I have added MyLapTimer class to make code more self-documenting and readable.
Also in your original source you forgot to call video.start() to initiate capturing from camera.