/** * blue = smallest (shrimp) blob * red = largest (jumbo) blob */ import hypermedia.video.*; OpenCV opencv; int w = 320; int h = 240; float value = 80; boolean preview = true; void setup() { size( w, h ); opencv = new OpenCV( this ); opencv.capture(w,h); println( "Drag mouse inside sketch window to change threshold" ); } void draw() { Blob[] blobs; background(0); noStroke(); opencv.read(); opencv.flip( OpenCV.FLIP_HORIZONTAL ); opencv.convert( OpenCV.GRAY ); opencv.absDiff(); opencv.threshold(value); image( opencv.image(OpenCV.MEMORY), 0, 0 ); if ( preview ) image( opencv.image(), 0, 0 ); // find jumbo blob blobs = opencv.blobs( 1000, w*h, 1, false ); fill(255,0,0); if ( blobs.length>0 ) { beginShape(); for( int i=0; i0 ) { beginShape(); for( int i=0; i