import processing.video.*; import blobDetection.*; import traer.physics.*; ParticleSystem physics; Particle last; Capture cam; BlobDetection theBlobDetection; PImage img; boolean newFrame=false; void setup() { size(640, 480); // camera cam = new Capture(this, 320, 240, 15); // blobdetection img = new PImage(320,240); theBlobDetection = new BlobDetection(img.width, img.height); theBlobDetection.setPosDiscrimination(true); theBlobDetection.setThreshold(0.15f); // will detect bright areas whose luminosity > 0.2f; // particles physics = new ParticleSystem( -0.1, 0.001 ); } void captureEvent(Capture cam) { cam.read(); newFrame = true; } void draw() { if (newFrame) { background(100); newFrame=false; theBlobDetection.computeBlobs(cam.pixels); drawBlobs(); } // particles physics.tick(); for ( int i = 0; i < physics.numberOfParticles(); ++i ) { Particle p = physics.getParticle( i ); noStroke(); fill( 250, 255/(p.age()*+1) ); ellipse( p.position().x(), p.position().y(), 5, 5 ); if ( p.age() > 20 ) p.kill(); } } void drawBlobs() { Blob b; EdgeVertex eA,eB; for (int n=0 ; n