import java.awt.Graphics; public class StagnantCam extends MotionDetectorCam { int restart = 1; int eventCount = 1; int restartCount = 1; long lastTime = 0; StagnantCam(){ super(); setTitle("StagnantCam"); } public static void main(String[] arglimentos) { StagnantCam sc = new StagnantCam(); } public void newFrame() { long now = System.currentTimeMillis(); float percentageChange = getAmountOfChange(threshold); if (percentageChange > 0.0026f){ lastTime = now; restart++; put("restarted @ " + System.currentTimeMillis() + " + " + restartCount++); } if (percentageChange < 0.025f && now - lastTime > 10 * 300) { ps.getImage(freezeFrame); lastTime = now; makeJPegFile(freezeFrame, "stagnation" + eventCount, ".jpg", 0.5f); put("EVENT @ " + System.currentTimeMillis() + " + " + eventCount++); } super.newFrame(); } public void paint(Graphics g) { g.drawImage(freezeFrame, 0, 0, null); } }