flashbacker
YaBB Newbies
Offline
Posts: 1
animated disappearance for motion tracking
Apr 23rd , 2008, 2:24pm
Hi, I'm quite new to processing. I've done a motion tracking object with JMyron library by picking up different exemples... It's working really nice, but i would like the cross to disapear by becoming smaller... This is for my last art student project. I've already done it with Isadora, but it seems that it would be really more efficient with processing. So if anybody got an idea... I tried to compare previous and current blobCenters lists, but didn't managed, and finally don't think it can work well... Here is the code of motion detection and tracking I can send isadora patch if you want to better match what i want to do. import JMyron.*; import processing.video.*; boolean hijack = false; boolean firstRun = true; JMyron m;//a camera object // Needed on an apple mac? import quicktime.*; void setup(){ size(400,300); // initialise qt - on a mac only? try{ QTSession.open(); } catch (Exception e) { e.printStackTrace(); } m = new JMyron();//make a new instance of the object m.start(width,height);//start a capture m.findGlobs(1);//enable the intelligence m.trackColor(255,255,255,3*256-100); m.update(); m.adaptivity(12); m.adapt(); m.minDensity(250); m.maxDensity(500); } void draw(){ background(255); m.update();//update the camera view drawCamera(); noFill(); int[][] a; //draw center points of globs a = m.globCenters(); stroke(255,255,0); for(int i=0;i<a.length;i++){ int[] p = a[i]; point(p[0],p[1]); } int [] [] centers = m.globCenters(); //draw bounding boxes of globs a = m.globBoxes(); rectMode(CORNER); fill(0,0,0); noStroke(); rect (0,0,400,300); noStroke(); fill(0,120,220); for(int i=0;i<a.length;i++){ int[] b = a[i]; rectMode(CENTER); rect(b[0], b[1], 6, 35); rect(b [0], b [1], 35,6); } //adjust the tracking color //using the average color of the current image // int avgColor = m.average(0,0,width,height); // m.trackColor(int(red(avgColor)),int(green(avgColor)),int(blue(avgColor)),150); } void drawCamera(){ if(firstRun){ m.adapt(); firstRun=false; } //create image of movie int[] img = m.differenceImage(); // int[] img = m.retinaImage(); // int[] img = m.cameraImage(); //first draw the camera view onto the screen loadPixels(); } // Called every time a new frame is available to read public void stop(){ m.stop();//stop the object super.stop(); }