« Creating a Window | Main | Problems with Creating a Window »

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);
}
}

TrackBack

TrackBack URL for this entry:
http://www.catmindeye.com/mt/mt-tb.cgi/24

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)