FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Video, Camera
(Moderator: REAS)
   videotracking -> differences 2 BImage
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: videotracking -> differences 2 BImage  (Read 1895 times)
michael05

WWW
videotracking -> differences 2 BImage
« on: Mar 17th, 2004, 1:28pm »

here is another videotracker. it is a part of my diploma "demographic data in augmented reality" (http://digitaleinformationsarchitektur.m05.de).
 
it takes a reference image of the background to compare all frames from the camera with it. if a person enters the scene it extracts it as a BImage with alpha channel. it returns that image and an array with its size (x1, y1, x2, y2).
you can manipulate that image (filters: invert, clone, proportional fill) or just use the coordinates or both..
 
there is just a german documentation of the project yet. i will post it when there will be a english documentation.
 
tracker.java - http://dev.m05.de/p5/trackerDiff/code/Tracker.java  
tracker.class - http://dev.m05.de/p5/trackerDiff/code/Tracker.class
 
to use the tracker in your project put tracker.class in the code folder.
 
here is a sample to initialize it:
 
trackerDiff.pde - http://dev.m05.de/p5/trackerDiff/trackerDiff.pde
 
 
 
Tracker t;
boolean bgSet = false;
int tolerance;
float diff;
BImage diffImage, bgImage;
 
void setup()
{
  size(320,240);
  noFill();
  stroke(#FFFF00);
  background(0);
  beginVideo(320,240,25);
  tolerance = 20; // treshold.. rbg+-value
  diff = width/video.width; // relation between screensize and videosize
 
  // initialize the tracker
  t = new Tracker();
  t.Tracker(tolerance, video.width, video.height);
}
 
void loop()
{
  //background(0);
  image(video, 0, 0); // show video
  if (bgSet == true)
  {
    // compare the video image with the reference image
    // returns an array with x1, y1, x2, y2 (upper left and bottom right)
    int[] rectPoints = t.GetPixelDiff(video, bgImage, diff);
 
    // returns an image of this area with alpha channel
    diffImage = t.GetPixelDiffImg();
     
    // draw a rect in this area
    rect(rectPoints[0]*diff, rectPoints[1]*diff, (rectPoints[2]-rectPoints[0])*diff, (rectPoints[3]-rectPoints[1])*diff);
  }
}
 
void keyReleased()
{
  // make a shot of the background -> reference image
  bgImage = t.GetRefBackground(video);
  bgSet = true;
}
 
 
 
 
 

°°°°°°°°°°°°°°°°°°°°
http://www.m05.de
c
Guest
Email
Re: videotracking -> differences 2 BImage
« Reply #1 on: Mar 29th, 2004, 9:06pm »

hi michael
 
this does only work for mac, doesnt it?
tried it on PC (+VDIG/QT) and there was  
a problem with p5 finding Qtjava and  
opening eg using the tracker.class.
 
beste gruesse
christian
 
michael05

WWW
Re: videotracking -> differences 2 BImage
« Reply #2 on: Apr 7th, 2004, 8:44pm »

hi
 
i did not try it on a windows pc. but now i ve got dell notebook from my school. i will try it when i find the time.
 
greetings from the eastcoast
 
michael
 
 
 
 
 

°°°°°°°°°°°°°°°°°°°°
http://www.m05.de
Pages: 1 

« Previous topic | Next topic »