Motion tracking through CCV, QC and Animata

AB's picture

Hi there,

I'm working on a motion tracking project and got into QC for that. Let me remind you that I'm a complete dummy in QC !

Let me explain where I'm to right now :

An actor wearing IR emiters ( ping-pong balls+IR lightspot ) is filmed with an IR cam (cam+ir filter), so that only blobs shows on the video. ( I tried using Wiimote, but it seems complicated since only 4 blobs are tracked... )

This input video goes through Community Core vision software, that allows me to send OSC signals. It's TUIO, wich means I'm able to grab that data in QC with the plugin available here. So far, I'v been able to track some blobs and have them rendered in QC.

I've also downloaded Mansteri's QC plugin, that allows me to send OSC messages to the software I'm planning to use to compose my puppets : Animata. Each blobs coordinates is to be sent to a precise joint or bone of my puppet, that I can target by using its name. The coordinates are separated. I have a node for X axis, and another one for Y axis...

My problem is that I successfully created a connection between CCV and QC on the one hand, and between QC and Animata, on the other hand, but I just can't figure out how to extract and separates blobs coordinates in QC !

With the TUIO plugin, I get blobs coordinates as a structure. In order to send it to Animata, I have to send x and y coordinates separately and I can't figure out how this can be done...

Knowing nearly nothing of qc language doesn't help... So I'm asking here, can this be done ?

Long story short : I have a structure input type, that contains blobs ids and their coordinates. How can I separate them by ID, then by axis X and Y ?

Hope I'm clear enough here... Dont hesitate to ask for further infos. If you know of a simple way to do what I'm trying to do I'd be glad to hear it !

Thanks for your interest and patience,

See you,

ABelliqueux

gtoledo3's picture
Re: Motion tracking through CCV, QC and Animata

The "structure index" and "structure key member" are the two patches you'll need to look at.

If you have an incoming structure in Quartz Composer, that is indexed - a list of numbers - the structure index will output the single element of the structure that has the corresponding index. So if you have a structure with elements 0, 1, 2 that represent X, Y, Z, you would put three structure index patches on your editor, pop 0, 1, and 2 into the index members...now you have a split up structure.

Named structures are pretty similar. If your structure contains key names, you can place that keyname in the "key" input (like "x" if your structure actually is outputting an x key).

If you have a structure with different "keys" that have substructures that are indexed, you can just chain the two to break the structure off further.

That should get you going, hopefully.

This should be easy to do since you have to name your incoming OSC anyway... just set up structure key member patches with corresponding names, and then you'll be able to have each individual value.

AB's picture
Re: Motion tracking through CCV, QC and Animata

Thanks a bunch for quick response, I'm going to have a look and will feedback soon !

dust's picture
Re: Motion tracking through CCV, QC and Animata

here this is how you kill all blobs with one shot in a iterator. just make sure to name your joints, joint0, joint1, joint2 etc.. or you just change the base namespace to what ever you want.

can you explain how your making your pingpong balls IR ? or are you just using them as a tracker because they are white ?

PreviewAttachmentSize
tuio2animata.qtz19.24 KB

AB's picture
Re: Motion tracking through CCV, QC and Animata

Thanks for the info. If I'm getting it right, I have to use this if I want to reset my blobs tracking ?

About the IR balls, I'm using quite the same technic as explained here, except I replaced the white light source with IR light source, plus added IR filter. To cut it short, I'm sticking reflecting tape on the tennis table balls, so that it reflect IR light. That way, I don't have to set up a cyclo in order to perform motion tracking. ( Though I think I won't be able to use it with candles or sun in the camera field...).

About the structure, I have a question :

When I leave the cursor over my object node, I can see a tooltip popup with the list of members, and the names of parameters. I'm assuming that the numbers on the left of each member, and on each of the parameters are the index number , and the quoted data are the index keys, am I correct ? See the picture for clearer infos :/

In that example, if I want to get to the "ypos" data , I should either use two "structure index member" patches, which first's parameters would be "0", and the second's "5", OR I could use two "structure key member patches" which parameters would be "0" and "ypos"... Is that right ?

But then my "member output" has a virtual type. Can I link it to a value type input ? Or should I use a node to convert/extract a value from a virtual type ?

I'm sorry to be such a dummy...

Thanks again for responding !

PreviewAttachmentSize
qc_structure.jpg
qc_structure.jpg83.27 KB

micrem73's picture
Re: Motion tracking through CCV, QC and Animata

Hi! I'm trying to do exactly the same job! Using CCV, Animata, and IR leds! And in these exactly days!

Have you tried using OSCulator instead of Mansteri plugin? As ican read from forum, he did himself this, before writng the plugin.

I think the "how to" is inside this post: http://originalhamsters.com/blog/2008/12/15/animata-osc/

Let's keep in touch!

bye

michele

dust's picture
Re: Motion tracking through CCV, QC and Animata

qc is loose with its data types so normally you can get away with virtual but when dealing with structures i think its best practice to declare data types if you want to do any kind of sorting etc.. you should be all good with the tuio 2 animatta virtual as mansarati has declared the data types in OSC.

this is how you break down tuio. you need both structure index and key members and although qc reports an index number next to the "xpos" for instance that doesn't mean you can pull that data out via index. the order is.

tuio cursor > index member > key member > xpos,ypos, etc...

where each index member holds all the keyed values. you change the index member to select different blobs. im pretty sure martin is giving you xpos, ypos, x speed, y speed, m acceleration, and two types of ids one is unique to each blob and the other (cid) you will have to experiment with as its not a unique identifier and changes if your blob count changes.

so no index 5 will not pull xpos. what is in the between " " will tell you what the key is. with kineme structure and file tools it is possible to pull out keyed values out via index.

leon's picture
About IR-LEDs or Reflection

Hi Michele

Be careful with IR-LEDs. I tried to use them with the wiiMote on stage conditions with parallel projections, and it didn't work out, was to unstable. Later I found out that it was due to the Frequency of the IR-Light. For the wiiMote cam, you have to use a frequency of 940nm, or something like that - really easy to check out, but I didn't know I had to check it out...

I think there is one big argument to use reflection: you can control better the light source. You use a much brighter light (using a reflector with a filter) so you do have less interference with other light sources, and can go further away. With theater lights, you can control if it is open (PAR, Fresnel) or delimited (Leekos, programed Scanners). You can also use many sources to cover the space, or have a space without reflection to ignore areas. For IR-light sources, I found a interesting info: There was a IR-Nightvision-viewfinder used by the swiss army in the 70s and then very popular on ebay, and it had a lamp with a filter sold separately. I bought some of that glass filters, but now I can't find the info. Anyway, just pay attention to the light range and look for a filter big enough to fit reflectors, or a LED-Reflector.