Code for CatTimeLapse Extending WebCam
import java.awt.Graphics;
public class Cattimelapse extends WebCam {
long lasttimetaken = 0;
public static void main(String[] args) {
Cattimelapse mytimelapse = new Cattimelapse ();
}
public void newFrame (){
long now = System.currentTimeMillis();
if (now- lasttimetaken >10*1000){
put("grabit");
grabPicture(freezeFrame);
makeJPegFile(freezeFrame, "C:\\",getTimeString()+ "test.jpg", 1.0f);
//postFileToITP("C:\\", "test.jpg", "/home/clc219/public_html/VideoSensing/", "WC" + getTimeString() + ".jpg" );
lasttimetaken = now;
}
super.newFrame();
}
public void paint(Graphics g) {
g.drawImage(liveImage ,0,0,null);
g.drawImage(freezeFrame, kWidth, 0, null);
}
}