/* Keepmax (c) Andrew Senior 2006 (works on processing 0115Beta) http://www.andrewsenior.com/ Please keep this header when redistributing This is a very simple toy that keeps the maximum brightness value at each pixel You can achieve some interesting effects with this in a darkened room and some light sources (torch, cellphone, LED) as seen in Darcy's Light Tracer: http://lighttracer.darcy.co.nz/ click with the mouse to reset the display. */ import JMyron.*; float M_PI=3.14159; int BITMASK=0xff; JMyron m;//a camera object //variables to maintain the floating green circle void setup(){ // Set this to your video source's size size(352,288, P3D); // size(320,240); m = new JMyron();//make a new instance of the object m.start(width,height);//start a capture at chosen size println("Keep max pixel using Myron " + m.version()); rectMode(CENTER); noStroke(); } void draw(){ m.update();//update the camera view from JMyron drawForeground(); } void drawForeground(){ int[] CurrentFrame = m.image(); //get the current image of the camera loadPixels(); int iPixel, iBackground; for(int i=0;i>16)&BITMASK; int iG=(iPixel>>8)&BITMASK; int iB=(iPixel>>0)&BITMASK; int iRM=(iDisplay>>16)&BITMASK; int iGM=(iDisplay>>8)&BITMASK; int iBM=(iDisplay>>0)&BITMASK; // Method one keep max in each of R,G,B // pixels[i] = color(max(iR,iRM), max(iG, iGM), max(iB, iBM)); // Method two keep brightest pixel if (iR+iG+iB>iRM+iGM+iBM) pixels[i]=iPixel; } updatePixels(); } void mousePressed(){ // m.settings();//click the window to get the settings for(int i=0;i