nikos-av
YaBB Newbies
Offline
Posts: 2
tracking and live capture(video)
Jan 20th , 2007, 3:40pm
so, as you can guess from the subject of my new topic, i have searched so far projects that have been made using video and what i have found that i think will help in my project is this code: ((** The basic concept is, when somebody enters a black room, the camera(which will be connected to the computer) will recognize the figure, and then with the processing analyzing/understanding it, according to the height of the person, a musical instrument will be generated and be projected on the wall. For example when a short man enters the room, a violin will appear on the wall, but if a tall man enters, a guitar or another musical instrument will be generated and projected.)) original code(you must have the files from the link below): // trackerDiff.pde // // part of the project 'demographic data in augmented reality' // http://digitaleinformationsarchitektur.m05.de // // 2003 michael zoellner // 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; } the previous thread is here by my fellowstudent so you can have a look.http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Video;action=display;num=1162291585 Thanks in advance!!!