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
   Tools
(Moderator: REAS)
   vTracker class
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: vTracker class  (Read 4010 times)
toxi

WWW
vTracker class
« on: Sep 9th, 2003, 5:22pm »

hey ho, having eventually purchased one of those easter-egg lookalike webcams, i jumped straight on the bandwagon and followed robert's call to action to play around with the code of his bootiful tracking example in the software section...
 
so i rewrote the whole thing as separate class to make it easier to implement into your own projects and also to allow for multiple instances tracking several colours/entities in the video image. though, IMHO the main improvement is speed and the switch from luminance based tracking to using tracking colours with a certain tolerance factor. this seems to work quite well so far...
 
obvious quality improvements will be to actual work with the average colours of pixel blocks rather than examining single pixels (as happens currently) - but i will wait with that until the new imaging functions are implemented in P5.
 
anyway, hope that's useful to some of you - here's the (commented) code (incl. demo):
http://www.toxi.co.uk/p5/vTracker/vTrackerCol.pde
 
the demo is using 2 instances to track near white and bright red areas by default. you can click anywhere in the image to pick a new colour for always one of the trackers (in turns)... if the cursors seems to be all over the place (a sign of failed tracking), you might need to reduce the tolerance values in the lines where the instances are created.
 

http://toxi.co.uk/
Rien Daamen

Email
Re: vTracker class
« Reply #1 on: Nov 24th, 2003, 12:05pm »

Very nice example!
I used to do this with an Xtra in Lingo, but now processing seems to give more control.
Is this possible with more camera's at the same time? (can I adress to a specific usb port?)
 
Rien
 
flight404

WWW Email
Re: vTracker class
« Reply #2 on: Nov 24th, 2003, 8:00pm »

Wonderful, Toxi.  I was actually thinking of getting you to look at the code to see how to optimize it.  I had a feeling I was going about it the long way.
 
I am interested in seeing how to find color blobs in the way that SetPixel has with his Director work (Noticed an interview with you, Toxi, at setpixel.com).
 
I wanted to find a way to track a specific blob of color but couldn't wrap my head around how to do it in a processor friendly manner.
 
Yay, Toxi.  
 
toxi

WWW
Re: vTracker class
« Reply #3 on: Nov 25th, 2003, 2:01pm »

funny, someone digged it up again - you know, that this is almost 3 months old but cheers anyway!
 
yeah, tracking blobs would be nice... in general i think charles' approach (using a threshold image and then floodfilling it with colour coding for each blob) is quite nice, but some more vector math in there would probably be helpful to track them more confidently over time. your code is a good basis though too. i'm sure there's a relative easy way to utilize the deltaCol value of each pixel... what if you store it for each pixel in another array, you could then parse this resulting "tolerance image" to find the bounding box(es) for the currently tracked colour.
 

http://toxi.co.uk/
flight404

WWW Email
Re: vTracker class
« Reply #4 on: Nov 25th, 2003, 6:00pm »

Heh, didnt even realize.  I don't often go into Tools because I just assume I won't understand what is going on.
 
And in the case of your explanation about parsing a second array, it seems that I was correct... no idea what you are talking about.
 
 
toxi

WWW
Re: vTracker class
« Reply #5 on: Nov 25th, 2003, 8:10pm »

sorry, if i wasn't very clear... as usual!
 
i was referring to the "deltaCol" variable in the existing analyse() code. its value is the difference to the tracked colour for each examined pixel. so if you store this value in another array, you basically translate the current video image into one which represents the tolarance to the tracked colour. makes sense? i've made some minor changes to the code to show what i mean:
 
http://www.toxi.co.uk/p5/vTracker/tolerance/
 
the white/bright areas in the right image are all pixels whose colour is within the tracking tolerance. click anywhere in the left image to choose a different colour to track, the right image will reflect the changes accordingly. now what's needed is to examine this right image to find consecutive areas (blobs) of bright pixels and which you could then track as entity over time. though, that sounds easier than it is, i guess...
 

http://toxi.co.uk/
flight404

WWW Email
Re: vTracker class
« Reply #6 on: Nov 25th, 2003, 11:22pm »

I feel like we should start a 'STUMP TOXI' discussion forum where the only point is to get Toxi to say the phrase, 'I have no idea how you would do that'.
 
If she is able to figure out the problem, she has to provide code (non-copyrighted) and send proper documentation as to how she reached her conclusion.
 
If she is not able to figure out the problem, she has to upload a video in which she is slapping herself (hard) next to a copy of that days newspaper.  She must also repeat the phrase, 'I make God cry when I fail' over and over.
 
r
 
arielm

WWW
Re: vTracker class
« Reply #7 on: Nov 25th, 2003, 11:43pm »

r, i'm loosing you when you switch to "she"...
 
do you mean: having toxi stand in a hermetic glass box over the thames river (with only one computer, with p5 pre-installed), while adventurous women submit him very challenging computer science problems at the condition that they previously solved them and post the solution (open-source code included, GNU Lesser General Public License prefered) on a 128 bit encrypted ssl server?
 
and in case these women only want to submit toxi some problems without being able to solve them, they would have to prove that they effectively harmed themselves before joining the long queue of women waiting under the glass box?
« Last Edit: Nov 25th, 2003, 11:46pm by arielm »  

Ariel Malka | www.chronotext.org
flight404

WWW Email
Re: vTracker class
« Reply #8 on: Nov 26th, 2003, 2:38am »

SON OF A BITCH!!!!
 
I feel like such a idiot.  All this time, I thought Toxi was a she.  I blame my southern upbringing.  I knew a Karsten in elementary school and SHE was a tall thin female with headgear and a propensity to spit when speaking loudly.
 
Jeez.  Is my face red.
 
Toxi, my darling, forgive me for the incorrect gender assignment.  I meant no harm.
 
embarrased in massachusetts,
robert
 
 
Postscript...
Ariel, are you a she?  I mean there was that whole Little Mermaid movie and frankly, I just don't know what to trust anymore.
« Last Edit: Nov 26th, 2003, 2:46am by flight404 »  
arielm

WWW
Re: vTracker class
« Reply #9 on: Nov 26th, 2003, 10:15am »

my advice is that you slow down with walt disney movies, it could be one of the reasons why you don't know what to trust anymore!
 
(said with a (filtered?) baritone voice, suggesting the absence of a second X chromosome...)
 

Ariel Malka | www.chronotext.org
toxi

WWW
Re: vTracker class
« Reply #10 on: Nov 26th, 2003, 1:36pm »

ok roberta, just to have it black on beige here...
 
ariel is spot on and even though "queen" sometimes applies to non-females, unfortunately, it is not fitting for uncle toxi. but don't be too embarassed, the brits got it wrong too with my 1st british social security number... must be a language barrier thing, although i'm sure as little boy you might have known a "kirsten", rather than a "karsten" as the latter is just the danish version of "christian" and this AFAIK is not unisex ...anyway, you're forgiven!
 
but really, is my situation on these holy boards that serious? am not sure, if i should be feeling embarrassed myself. on the other hand, i like ariel's idea of adventurous women submitting to me so bring it on!! not sure about the plexi glass box though. the international media might not have portrayed this properly for reasons of hype, but the people of london were quite nasty, and cunningly at that, to poor little david-in-the-box.
 
aaaaand finally, just trying to bring the discussion slowly back to the original topic: forgot to mention yesterday the tolerance image above is pretty much the same what photoshop does when you "select colour range".
 
now i just had an idea that might help finding the shapes of those areas. remember the meta blobs, v3ga did a while ago? you could use that "marching squares" alrgorithm to find the outlines of the selected pixel areas. should be right up your street as it leads you halfway back to voxelspace...
 

http://toxi.co.uk/
madmerv
Guest
Email
Re: vTracker class
« Reply #11 on: Nov 26th, 2003, 7:37pm »

http://amp.ece.cmu.edu/downloads.htm
 
some cool stuff to do with cameras!
 
jingman

jakeingman
Re: vTracker class
« Reply #12 on: Jul 26th, 2004, 10:36pm »

I hate to barge in on you heavy hitters here, but I was wondering if the vTracker class should work with the 68 build of processing.  I tried it (with "noBackground()" commented out), and it just stuck the cursors in the corner - no video feed.
 
I verified that my webcam was functioning with processing.
 
I also haven't spent a huge amount of time going over the code, so I may be missing something obvious.  I was just wondering if there was some major part of the code that does not work in the current build.
 
Toxi and flight404 - thank you thank you thank you for all the inspiration.
 
jingman

jakeingman
Re: vTracker class
« Reply #13 on: Jul 28th, 2004, 6:42pm »

Should this perhaps be moved to the "Video" thread?
 
Pages: 1 

« Previous topic | Next topic »