import hypermedia.video.*; OpenCV opencv; int w = 320; int h = 240; int threshold = 80; boolean find=true; PFont font; void setup() { size( w*2+30, h*2+30 ); opencv = new OpenCV( this ); opencv.capture(w,h); font = loadFont( "AndaleMono.vlw" ); textFont( font ); println( "Drag mouse inside sketch window to change threshold" ); println( "Press space bar to record background image" ); } void draw() { background(0); opencv.read(); //opencv.flip( OpenCV.FLIP_HORIZONTAL ); image( opencv.image(), 10, 10 ); // RGB image image( opencv.image(OpenCV.GRAY), 20+w, 10 ); // GRAY image image( opencv.image(OpenCV.MEMORY), 10, 20+h ); // image in memory opencv.absDiff(); opencv.threshold(threshold); image( opencv.image(OpenCV.GRAY), 20+w, 20+h ); // absolute difference image // working with blobs Blob[] blobs = opencv.blobs( 100, w*h/3, 20, true ); noFill(); pushMatrix(); translate(20+w,20+h); for( int i=0; i0 ) { beginShape(); for( int j=0; j