// Dartmouth CS 2, Winter 2009, Chris Bailey-Kellogg // Notes 21 | Sketch 2 import JMyron.*; JMyron video; // Video capture PImage baker; // Custom "clothing" void setup() { size(640,480); smooth(); baker = loadImage("baker-small.jpg"); video = new JMyron(); video.start(width,height); video.minDensity(1000); // decent-sized globs video.trackColor(0,0,0,200); // fairly dark globs } void draw() { video.update(); // Use window temporarily, drawing globs in black on a white background background(255); noStroke(); fill(0); int[][][] edgePointSets = video.globEdgePoints(30); // an array (over globs) of arrays (over edge points) of 2 elements (0=x, 1=y) for (int eps=0; eps transparent as mask) where globs are PImage cam = createImage(width,height,ARGB); cam.loadPixels(); video.imageCopy(cam.pixels); PImage msk = get(); cam.mask(msk); // Put Baker in bounding boxes of globs background(0,255,0); int[][] bboxes = video.globBoxes(); // an array (over globs) of corners and sizes of rectangles for (int bb=0; bb