Forums > Jitter

IR tracking

October 4, 2007 | 9:58 pm

Greetings Folks

I am working on a project that involves tracking IR LED’s used as markers –

one issue is that an LED is not real large -particularly at a distance – so I am working on creating a larger marker…

In my testing with cv.jit.track and jit.findbounds (tutorial 25) the CV object loses the VERY small led much more easily than the findbounds…

I did try using the cv.jit.dilate object as a precursor to the cv.jit.track object in hopes of making my object bigger and thus easier to track…

I was hoping to us the cv.jit object due to the ability to track several objects – particularly ones that come through the same color…

any ideas with this one?

thanks
jamie


October 5, 2007 | 12:52 am

ok.

1) which cv.jit object?

2) can you post your patch?

j

On Oct 4, 2007, at 5:58 PM, jamie jewett wrote:

> Greetings Folks
>
> I am working on a project that involves tracking IR LED’s used as
> markers -
>
> one issue is that an LED is not real large -particularly at a
> distance – so I am working on creating a larger marker…
>
> In my testing with cv.jit.track and jit.findbounds (tutorial 25)
> the CV object loses the VERY small led much more easily than the
> findbounds…
>
> I did try using the cv.jit.dilate object as a precursor to the
> cv.jit.track object in hopes of making my object bigger and thus
> easier to track…
>
> I was hoping to us the cv.jit object due to the ability to track
> several objects – particularly ones that come through the same
> color…
>
>
> any ideas with this one?
>
> thanks
> jamie
>
>
>


October 5, 2007 | 1:45 am

sorry – I didn’t think it mattered as I had not really gone very far – but here’s all the info

as I mentioned I was looking at cv.jit.track and then tried making the tracked object bigger using cv.jit.dilate before tracking with the cv.jit.track

I’m finding that jit.findbounds works better – I can post that patch as well if it would be helpful

I’m on a 2.4 Ghz macbook pro, 4 gigs of ram, jit 1.6.3, max 4.6.3, OS 10.4.10, quicktime 7.1.6,

thanks for any thoughts…

essentially just a simple hack of the help files as follows:

max v2;
#N vpatcher 445 71 1847 1132;
#P user gswitch 402 549 41 32 0 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 557 770 88 196617 cv.jit.track.draw;
#P user jit.fpsgui 750 648 60 196617 0;
#P number 1010 724 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 973 724 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 973 693 47 196617 unpack;
#P user jit.cellblock 543 883 589 903 3 9 1 1 45 20 0 1 1 0 0 0 0 0 0 0 0 0 255 255 255 0 0 0 0 0 0 191 191 191 0 0 0 215 215 240 1 1 1 0 4 0 0 0;
#P user jit.cellblock 543 859 589 879 3 9 1 1 45 20 0 1 1 0 0 0 0 0 0 0 0 0 255 255 255 0 0 0 0 0 0 191 191 191 0 0 0 215 215 240 1 1 1 0 4 0 0 0;
#P user jit.cellblock 543 832 589 852 3 9 1 1 45 20 0 1 1 0 0 0 0 0 0 0 0 0 255 255 255 0 0 0 0 0 0 191 191 191 0 0 0 215 215 240 1 1 1 0 4 0 0 0;
#P newex 543 805 61 196617 jit.unpack 3;
#P message 900 693 62 196617 set 0 $1 $2;
#P newex 900 666 63 196617 route mouse;
#P window linecount 4;
#P comment 633 606 57 196617 Change the size of the search window.;
#P number 579 601 35 9 1 7 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P message 579 622 51 196617 radius $1;
#P newex 557 719 113 196617 cv.jit.track @npoints 1;
#P user jit.pwindow 749 500 162 122 0 1 0 0 1 0;
#P user panel 742 469 180 160;
#X brgb 140 140 140;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 571 595 124 72;
#X brgb 198 198 198;
#X frgb 140 140 140;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 549 704 144 44;
#X brgb 210 210 195;
#X frgb 140 140 140;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 535 829 298 78;
#X brgb 210 210 195;
#X frgb 140 140 140;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 965 715 158 35;
#X brgb 210 210 195;
#X frgb 140 140 140;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user jit.fpsgui 75 533 60 196617 0;
#P window linecount 3;
#P comment 327 282 245 196617 Switch between binary and greyscale mode using grayscale attribute. Works also with "greyscale" spelling!;
#P window linecount 2;
#P comment 454 231 90 196617 Mode 1: cross neighbourhood;
#P toggle 403 214 15 0;
#P window linecount 1;
#P message 403 234 45 196617 mode $1;
#P window linecount 2;
#P comment 454 201 90 196617 Mode 0: square neighbourhood;
#P user panel 391 194 161 68;
#X brgb 198 198 198;
#X frgb 140 140 140;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P window linecount 1;
#P comment 517 365 98 196617 Greyscale dilatation;
#B frgb 255 255 255;
#P user jit.pwindow 453 382 162 122 0 1 0 0 1 0;
#P user panel 443 359 184 154;
#X brgb 140 140 140;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P newex 194 292 125 196617 cv.jit.dilate @grayscale 1;
#P comment 343 365 83 196617 Binary dilatation;
#B frgb 255 255 255;
#P user jit.pwindow 265 382 162 122 0 1 0 0 1 0;
#P user panel 255 359 184 154;
#X brgb 140 140 140;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P newex 117 292 61 196617 cv.jit.dilate;
#P newex 75 210 64 196617 jit.rgb2luma;
#P comment 170 365 65 196617 Binary image;
#B frgb 255 255 255;
#P window linecount 3;
#P comment 254 212 105 196617 Change thresholding value to obtain a binary image;
#P user jit.pwindow 74 382 162 122 0 1 0 0 1 0;
#P number 212 218 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 75 243 101 196617 jit.op @op > @val 50;
#P user panel 208 205 157 49;
#X brgb 198 198 198;
#X frgb 140 140 140;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P comment 692 401 163 196617 Any type , 1-plane matrices;
#P comment 690 366 163 196617 Any type , 1-plane matrices;
#P newex 75 186 125 196617 jit.matrix 4 char 160 120;
#P comment 643 401 41 196617 Output:;
#B frgb 247 247 247;
#P comment 643 366 34 196617 Input:;
#B frgb 247 247 247;
#P user panel 639 395 51 28;
#X brgb 140 140 140;
#X frgb 198 198 198;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 639 359 51 37;
#X brgb 140 140 140;
#X frgb 198 198 198;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 639 359 218 36;
#X brgb 198 198 198;
#X frgb 140 140 140;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 639 394 218 29;
#X brgb 198 198 198;
#X frgb 140 140 140;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P message 104 139 44 196617 settings;
#P flonum 347 87 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 347 108 42 196617 rate $1;
#P comment 221 85 131 196617 …or use a movie file;
#P comment 55 85 105 196617 Use live camera input;
#P toggle 197 84 15 0;
#P newex 197 108 46 196617 metro 2;
#P message 250 108 28 196617 read;
#P message 315 108 27 196617 stop;
#P message 281 108 31 196617 start;
#P newex 197 138 61 196617 jit.qt.movie;
#P message 117 108 31 196617 close;
#P message 86 108 28 196617 open;
#P toggle 33 84 15 0;
#P newex 33 108 46 196617 metro 2;
#P newex 33 138 54 196617 jit.qt.grab;
#P user panel 190 73 201 94;
#X brgb 140 140 140;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P window setfont "Sans Serif" 24.;
#P comment 25 31 646 196632 Just a help file hack…;
#B frgb 129 71 36;
#P user panel 25 73 162 94;
#X brgb 140 140 140;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 64 359 184 154;
#X brgb 140 140 140;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 188 275 393 51;
#X brgb 210 210 195;
#X frgb 140 140 140;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P connect 7 0 6 0;
#P connect 6 0 5 0;
#P fasten 9 0 5 0 122 130 38 130;
#P fasten 8 0 5 0 91 130 38 130;
#P hidden connect 20 0 5 0;
#P fasten 5 0 27 0 38 174 80 174;
#P fasten 10 0 27 0 202 174 80 174;
#P connect 27 0 36 0;
#P connect 36 0 31 0;
#P connect 31 0 33 0;
#P connect 33 0 51 0;
#P fasten 47 0 37 0 408 269 122 269;
#P fasten 31 0 37 0 80 274 122 274;
#P fasten 32 0 31 1 217 238 171 238;
#P fasten 47 0 41 0 408 269 199 269;
#P fasten 36 0 41 0 80 233 199 233;
#P connect 15 0 14 0;
#P connect 14 0 10 0;
#P fasten 13 0 10 0 255 130 202 130;
#P fasten 11 0 10 0 286 130 202 130;
#P fasten 12 0 10 0 320 130 202 130;
#P fasten 18 0 10 0 352 130 202 130;
#P fasten 37 0 39 0 122 345 271 345;
#P connect 19 0 18 0;
#P connect 48 0 47 0;
#P connect 37 0 73 1;
#P connect 41 0 73 2;
#P fasten 41 0 43 0 199 335 459 335;
#P fasten 58 0 64 0 562 761 548 761;
#P connect 64 0 65 0;
#P fasten 64 1 66 0 565 836;
#P fasten 64 2 67 0 582 833;
#P connect 73 0 58 0;
#P fasten 59 0 58 0 584 689 562 689;
#P fasten 63 0 58 0 905 715 562 715;
#P connect 58 0 72 0;
#P connect 60 0 59 0;
#P connect 73 0 72 1;
#P fasten 72 0 57 0 562 794 730 794 730 496 755 496;
#P connect 57 0 71 0;
#P connect 57 1 62 0;
#P connect 62 0 63 0;
#P fasten 62 0 68 0 905 688 978 688;
#P connect 68 0 69 0;
#P connect 68 1 70 0;
#P pop;

—– Original Message —-
From: joshua goldberg
Sent: Thursday, October 4, 2007 8:52:42 PM
Subject: Re: [jitter] IR tracking

ok.

1) which cv.jit object?

2) can you post your patch?

j

On Oct 4, 2007, at 5:58 PM, jamie jewett wrote:

> Greetings Folks
>
> I am working on a project that involves tracking IR LED’s used as
> markers -
>
> one issue is that an LED is not real large -particularly at a
> distance – so I am working on creating a larger marker…
>
> In my testing with cv.jit.track and jit.findbounds (tutorial 25)
> the CV object loses the VERY small led much more easily than the
> findbounds…
>
> I did try using the cv.jit.dilate object as a precursor to the
> cv.jit.track object in hopes of making my object bigger and thus
> easier to track…
>
> I was hoping to us the cv.jit object due to the ability to track
> several objects – particularly ones that come through the same
> color…
>
>
> any ideas with this one?
>
> thanks
> jamie
>
>
>


October 5, 2007 | 1:56 am

Don’t use cv.jit.track for these situations. Use cv.jit.label + cv.jit.blobs.centroids or cv.jit.blobs.bounds. cv.jit.blobs.bounds in particular works essentially like jit.findbounds but can track several objects at the same time.


October 5, 2007 | 2:29 am

many thanks!

I’ll give that a try

best
jamie

—– Original Message —-
From: Jean-Marc Pelletier
Sent: Thursday, October 4, 2007 9:56:14 PM
Subject: [jitter] Re: IR tracking

Don’t use cv.jit.track for these situations. Use cv.jit.label + cv.jit.blobs.centroids or cv.jit.blobs.bounds. cv.jit.blobs.bounds in particular works essentially like jit.findbounds but can track several objects at the same time.


October 5, 2007 | 3:55 am

Hello again

I tried using cv.jit.label but it sees the background as one large blob.. and does not see the two small points

any suggestions – I’m just working with the help file – no mods…

thanks
jamie

—– Original Message —-
From: Jean-Marc Pelletier
Sent: Thursday, October 4, 2007 9:56:14 PM
Subject: [jitter] Re: IR tracking

Don’t use cv.jit.track for these situations. Use cv.jit.label + cv.jit.blobs.centroids or cv.jit.blobs.bounds. cv.jit.blobs.bounds in particular works essentially like jit.findbounds but can track several objects at the same time.


October 5, 2007 | 4:28 am

You need to process the image before sending it to cv.jit.label. If you are tracking LEDs than I assume they show up as bright spots. Your object sequence would then be something like:
[jit.qt.grab]->[jit.rgb2luma]->[jit.op @op >]->[cv.jit.label @charmode 1]

The cv.jit.blobs.bounds helpfile is built this way. You need, of course, to provide jit.op with the proper threshold value. If it picks up the whole backgound, then your threshold value is too low.


October 5, 2007 | 11:16 am

CV objects also have threshold value argument (default 20). Try changing the value.

j


October 5, 2007 | 11:59 am

I use also JIT.BRCOSA with negative importance of the contrast, for determination integer
sorry for bad english *(


October 5, 2007 | 2:16 pm

no need for extra calculation . just change jit.op @op > into jit.op @op < to get inverse result .

j


October 11, 2007 | 2:10 am

Hi, I’m wondering what you’re using to pick up the IR — a special camera of some sort? Wondering if simply using a cluster of LEDs for each point would give cv. more to work with. I’m doing some sensor stuff too and would like to hear how your project is going. The nice thing about the IR LEDs (versus an IR distance sensor, which I’m using) is the price… very cheap.

The prior answers about processing the image / matrix are what you’re looking for, tweaking the threshold values for jit.op (after RGB2LUMA) does the trick. No need for jit.brcosa, though that’s certainly another way to do it. I do think (though I’m not sure) that a jit.op > or < is more efficient than jit.brcosa, based on the math needed (less complex calculations, usually). It's important to optimize what you can, as cv.blobs etc. use a lot of processing, just by their nature.

–CJ


October 11, 2007 | 2:43 am

Quote: seejayjames wrote on Wed, 10 October 2007 20:10
—————————————————-
It’s important to optimize what you can, as cv.blobs etc. use a lot of processing, just by their nature.
—————————————————-

Not really. cv.jit.label is fairly efficient and either blobs.bounds and blobs.centroids should not be particularly slower than jit.findbounds or cv.jit.centroids. The objects that really eat up CPU time are cv.jit.faces, cv.jit.HS/LKflow and cv.jit.lines.

For IR tracking, I had the best results with a few LEDs arranged in a distinctive L-shaped pattern. This allowed me to compute not only the position but the orientation and the slant of the object.


October 11, 2007 | 2:55 am

I am using some special high brightness LEDs from ebay –
they seem to have 3 elements in them and are quite large – 10mm I think –
If you sand the plastic then the light is defused and you can see the LED form any angle –

then I am using the cheapest sony camera I could find (used) on ebay that has night-night
Putting an inexpensive IR filter on this camera and I have found that using the night shot option works better than just the filter –
this said, I put a piece of tape over the IR emitter in the camera to minimize the general IR and this seems to help as well
you have to be careful of what the lighting is in the room you are in as well – dimmable compact fluorescents seem to work the best as florescent light has very little
IR in it.

I did find that going in to a jit.op > worked just fine and there was no need to do something more complicated….

the LEDs are quite small at a distance – so the large form factor has been quite important and work much better than the smaller units I found at a similar brightness…
you can grind the plastic on the LED and end up with something flatter if form factor is important…

hope this helps
jamie

—– Original Message —-
From: Seejay James
Sent: Wednesday, October 10, 2007 10:10:08 PM
Subject: [jitter] Re: IR tracking

Hi, I’m wondering what you’re using to pick up the IR — a special
camera of some sort? Wondering if simply using a cluster of LEDs for each
point would give cv. more to work with. I’m doing some sensor stuff too
and would like to hear how your project is going. The nice thing about
the IR LEDs (versus an IR distance sensor, which I’m using) is the
price… very cheap.

The prior answers about processing the image / matrix are what you’re
looking for, tweaking the threshold values for jit.op (after RGB2LUMA)
does the trick. No need for jit.brcosa, though that’s certainly another
way to do it. I do think (though I’m not sure) that a jit.op > or < is
more efficient than jit.brcosa, based on the math needed (less complex
calculations, usually). It’s important to optimize what you can, as
cv.blobs etc. use a lot of processing, just by their nature.

–CJ


October 11, 2007 | 3:26 am

the L shape is a good idea – here’s a link to a ‘real’ marker:

http://www.intelligent-surfaces.com/_products/accuTrack_markers.php

a wireless boomerang marker – bet those are cheap!

and better yet that your dancers will be happy wearing them –

mine just balked at 2 AAA batts and now I’m back to trying to get blood (100mA) from a stone (button cell)!

but I am finding the the oldschool ‘flingy’ or ‘throwie’ works surprisingly well – tape, a button cell and your LED!
can’t really understand why the spec on the LED says it wants 100-500 mA but it seems just as bright when driven by a 3mA max 3v button cell…

go figure…

jamie

—– Original Message —-
From: Jean-Marc Pelletier
Sent: Wednesday, October 10, 2007 10:43:58 PM
Subject: [jitter] Re: IR tracking

Quote: seejayjames wrote on Wed, 10 October 2007 20:10
—————————————————-
It’s important to optimize what you can, as cv.blobs etc. use a lot of
processing, just by their nature.
—————————————————-

Not really. cv.jit.label is fairly efficient and either blobs.bounds
and blobs.centroids should not be particularly slower than jit.findbounds
or cv.jit.centroids. The objects that really eat up CPU time are
cv.jit.faces, cv.jit.HS/LKflow and cv.jit.lines.

For IR tracking, I had the best results with a few LEDs arranged in a
distinctive L-shaped pattern. This allowed me to compute not only the
position but the orientation and the slant of the object.


October 11, 2007 | 3:36 am

You can also use a reflective marker like Skotchlite tape. This will reflect IR more strongly than any other material and thus will appear as a brighter spot in your image. You need a strong external IR light source but regular incandescent and halogen lights emit a lot of light in the IR spectrum.


October 11, 2007 | 4:06 am

also –

if you can make your LED’s a little ‘lamp shade’ lik with some interfacing or something you will end up with a larger – but friendly – target…

best
jamie


October 11, 2007 | 4:16 am

another idea would be to put some Skotchlite behind your LED with a tiny amount of space –
thus amplifying the size of the marker w/o having the external IR issue…
I ‘m gonna try that !

best
jamie

—– Original Message —-
From: Jean-Marc Pelletier
Sent: Wednesday, October 10, 2007 11:36:58 PM
Subject: [jitter] Re: Re: IR tracking

You can also use a reflective marker like Skotchlite tape. This will
reflect IR more strongly than any other material and thus will appear as
a brighter spot in your image. You need a strong external IR light
source but regular incandescent and halogen lights emit a lot of light in
the IR spectrum.


October 11, 2007 | 6:15 am

wow, my bad. Awesome that you’re on the forums Jean, your objects are fantastic. I guess I saw the performance drop only on my aging system ;-)

I have no idea what kind of algorithms you had to come up with to make these objects work, very complex, it’s great that you did. Thanks for all that!! These make a lot of additional projects possible…. wondering what cool stuff you’ve been working with.

–thanks again, CJ


November 7, 2007 | 3:27 pm

Quote: Jean-Marc Pelletier wrote on Wed, 10 October 2007 20:43
—————————————————-
> Quote: seejayjames wrote on Wed, 10 October 2007 20:10
> —————————————————-
> It’s important to optimize what you can, as cv.blobs etc. use a lot of processing, just by their nature.
> —————————————————-
>
> Not really. cv.jit.label is fairly efficient and either blobs.bounds and blobs.centroids should not be particularly slower than jit.findbounds or cv.jit.centroids. The objects that really eat up CPU time are cv.jit.faces, cv.jit.HS/LKflow and cv.jit.lines.
>
> For IR tracking, I had the best results with a few LEDs arranged in a distinctive L-shaped pattern. This allowed me to compute not only the position but the orientation and the slant of the object.
>
>
—————————————————-

Jean,

I am doing a very similar project, which will hopefully be 3 visible LED’s (instead of IR), which will be able to give me the x/y position, which I have already managed to do with your cv.jit.label and cv.jit.blobs.centroids objects (these are great by the way!). These LEDs will be mounted on a case which the user will hold, and will press against a fabric frame – the light from the LED lights up areas of the underside of the fabric and the camera tracks these light spots. I would really like to be able to get orientation data from these 3 spots – so twisting the case clockwse/anticlockwise will produce a value. I have tried using the cv.jit.direction and orientation objects, but am still a little confused as to their workings.

You say that you mount your LEDs in an L shape, and are able to get the orienation and the slant information out of these. Is this using the cv.jit.orientation or direction object? If I were to mount my LEDs in an isosceles triangle or L shape, would cv.jit.direction be able to calculate the angle of the triangle pointing to it’s tip? Also, I notice you say it computes the orientation of a shape’s main axis. If I have got 3 blobs on my screen (in a L shape for example), will it interpret the 3 blobs as 1 shape, or does this object only like to work with 1 shape to start with? I hope this makes sense :-)

Regards,


November 8, 2007 | 7:48 am

I’m just looking at the coordinates for the 3 points and calculating the distance between them. Since the shape is like an L, by looking at the length of the segments, I can know where each corner is. Also, if I know what relative length the segments should be if the shape were flat, I can also calculate (to some extent) the surface’s slant. For this, all I need the the cv.jit.blob.centroids object.

Quote: spbinns wrote on Wed, 07 November 2007 08:27

> You say that you mount your LEDs in an L shape, and are able to get the orienation and the slant information out of these. Is this using the cv.jit.orientation or direction object? If I were to mount my LEDs in an isosceles triangle or L shape, would cv.jit.direction be able to calculate the angle of the triangle pointing to it’s tip? Also, I notice you say it computes the orientation of a shape’s main axis. If I have got 3 blobs on my screen (in a L shape for example), will it interpret the 3 blobs as 1 shape, or does this object only like to work with 1 shape to start with? I hope this makes sense :-)


November 15, 2007 | 10:06 pm

Just want to mention that if you put an already processed/developed empty camera film-roll in front of a webcam it will filter out everything but the IR. Totaly cool for tracking IR in jitter! Im working on a similar project at the moment..


Viewing 21 posts - 1 through 21 (of 21 total)