Forums > Jitter

these tricky dots!!!

February 19, 2007 | 5:13 pm

Hi all,

I need to do some face tracking, I’ve tried several different approaches and so far the best results are obtained from the built-in software of a Logitech webcam. the webcam’s calibration window assigns red dots to the main features of human faces as shown in the image:[img]index.php?t=getfile&id=478&private=0[/img]

I am using jit.desktop to grab a region of the screen into max, I filter the matrix to get a binary image with only the tracking dots. I need now to do 2 things, 1.- to filter out the bounding box and to get coordinates of each dot.

I’ve tried with jit.findbounds but couldnt figure out how to track several instances of the same color, I’ve tried with some javascript conditionals but doesnt seem to run fast enough.

any suggestions.

example patch:

max v2;
#N vpatcher 0 0 950 522;
#P origin 1 -62;
#P window setfont "Sans Serif" 9.;
#P message 822 210 28 9109513 clear;
#N vpatcher 15 55 615 455;
#P origin 17 118;
#P outlet 366 735 15 0;
#P outlet 240 735 15 0;
#P outlet 114 735 15 0;
#P outlet -12 735 15 0;
#P inlet -12 -94 15 0;
#P user jit.cellblock -12 -75 861 637 139 9 160 120 19 16 0 1 1 0 0 0 1 1 1 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 connect 1 0 0 0;
#P connect 0 0 2 0;
#P connect 0 1 3 0;
#P connect 0 2 4 0;
#P connect 0 3 5 0;
#P pop;
#P newobj 545 287 52 9109513 p cellblock;
#P message 703 117 95 9109513 setcell $2 $3 val 254;
#P newex 580 324 26 9109513 print;
#P user jit.pwindow 716 321 162 122 0 1 0 0 1 0;
#P message 724 211 95 9109513 setcell $1 $2 val 254;
#P newex 721 245 133 9109513 jit.matrix dots 1 char 160 120;
#P newex 389 399 101 9109513 if $i1 == 0 then $i2 $i3;
#P newex 432 340 48 9109513 unpack i i;
#P newex 389 371 43 9109513 pack i i i;
#P newex 389 311 96 9109513 jit.iter 4 char 160 120;
#P button 1 98 15 0;
#P user jit.pwindow 196 314 162 122 0 1 0 0 1 0;
#P newex 48 244 66 9109513 jit.rgb2luma;
#P message 208 48 23 9109513 653;
#P message 165 48 18 9109513 35;
#P newex 165 21 45 9109513 loadbang;
#P window linecount 3;
#P newex 48 191 122 9109513 jit.chromakey @color 0. 1. 0. 0. @mode 1 @tol 0.2 @fade 0.1;
#P number 69 97 35 9 0 0 1 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 165 69 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 208 69 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 24 98 15 0;
#P window linecount 1;
#P newex 24 120 55 9109513 metro 100;
#P user jit.pwindow 23 314 162 122 0 1 0 0 1 0;
#P newex 24 153 143 9109513 jit.desktop 1 char @dim 160 120;
#B color 5;
#N vpatcher 15 55 615 455;
#P button 50 57 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 162 50 31 9109513 + 120;
#P newex 119 50 31 9109513 + 160;
#P newex 50 76 99 9109513 pack rect 0 0 160 120;
#P inlet 50 37 15 0;
#P inlet 72 56 15 0;
#P inlet 94 56 15 0;
#P inlet 119 30 15 0;
#P inlet 162 30 15 0;
#P outlet 50 100 15 0;
#P connect 5 0 9 0;
#P connect 9 0 6 0;
#P connect 6 0 0 0;
#P connect 4 0 6 1;
#P connect 3 0 6 2;
#P fasten 7 0 6 3 124 71 121 71;
#P connect 2 0 7 0;
#P fasten 8 0 6 4 167 71 143 71;
#P connect 1 0 8 0;
#P pop;
#P newobj 165 105 66 9109513 p osition;
#P user panel 193 311 168 129;
#X brgb 26 0 248;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 20 311 168 129;
#X brgb 26 0 248;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P connect 6 0 5 0;
#P connect 5 0 3 0;
#P connect 2 0 3 0;
#P connect 16 0 3 0;
#P connect 3 0 4 0;
#P connect 3 0 10 0;
#P connect 10 0 14 0;
#P connect 9 0 5 1;
#P connect 11 0 12 0;
#P connect 12 0 8 0;
#P connect 7 0 2 0;
#P connect 8 0 2 0;
#P connect 8 0 2 1;
#P connect 7 0 2 2;
#P fasten 14 0 15 0 53 290 202 290;
#P connect 8 0 2 3;
#P connect 11 0 13 0;
#P connect 13 0 7 0;
#P connect 7 0 2 4;
#P connect 14 0 17 0;
#P connect 17 0 18 0;
#P connect 18 0 20 0;
#P fasten 19 0 18 1 437 364 410 364;
#P fasten 19 1 18 2 475 368 426 368;
#P connect 17 1 19 0;
#P connect 14 0 26 0;
#P connect 26 0 24 0;
#P connect 21 0 23 0;
#P connect 27 0 21 0;
#P connect 22 0 21 0;
#P connect 16 0 21 0;
#P connect 5 0 21 0;
#P connect 20 0 22 0;
#P pop;


February 19, 2007 | 10:03 pm

did you check the cv.jit lib? there are many useful things one is an
object specialised on faces cv.jit.faces you can load a face model as
an xml description. Quite amazing actually.

falk
Am 19.02.2007 um 17:13 schrieb Miguel:

> Hi all,
>
> I need to do some face tracking, I’ve tried several different
> approaches and so far the best results are obtained from the built-
> in software of a Logitech webcam. the webcam’s calibration window
> assigns red dots to the main features of human faces as shown in
> the image:[img]index.php?t=getfile&id=478&private=0[/img]
>
> I am using jit.desktop to grab a region of the screen into max, I
> filter the matrix to get a binary image with only the tracking
> dots. I need now to do 2 things, 1.- to filter out the bounding box
> and to get coordinates of each dot.
>
> I’ve tried with jit.findbounds but couldnt figure out how to track
> several instances of the same color, I’ve tried with some
> javascript conditionals but doesnt seem to run fast enough.
>
> any suggestions.
>
> example patch:
>
> max v2;
> #N vpatcher 0 0 950 522;
> #P origin 1 -62;
> #P window setfont "Sans Serif" 9.;
> #P message 822 210 28 9109513 clear;
> #N vpatcher 15 55 615 455;
> #P origin 17 118;
> #P outlet 366 735 15 0;
> #P outlet 240 735 15 0;
> #P outlet 114 735 15 0;
> #P outlet -12 735 15 0;
> #P inlet -12 -94 15 0;
> #P user jit.cellblock -12 -75 861 637 139 9 160 120 19 16 0 1 1 0 0
> 0 1 1 1 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 connect 1 0 0 0;
> #P connect 0 0 2 0;
> #P connect 0 1 3 0;
> #P connect 0 2 4 0;
> #P connect 0 3 5 0;
> #P pop;
> #P newobj 545 287 52 9109513 p cellblock;
> #P message 703 117 95 9109513 setcell $2 $3 val 254;
> #P newex 580 324 26 9109513 print;
> #P user jit.pwindow 716 321 162 122 0 1 0 0 1 0;
> #P message 724 211 95 9109513 setcell $1 $2 val 254;
> #P newex 721 245 133 9109513 jit.matrix dots 1 char 160 120;
> #P newex 389 399 101 9109513 if $i1 == 0 then $i2 $i3;
> #P newex 432 340 48 9109513 unpack i i;
> #P newex 389 371 43 9109513 pack i i i;
> #P newex 389 311 96 9109513 jit.iter 4 char 160 120;
> #P button 1 98 15 0;
> #P user jit.pwindow 196 314 162 122 0 1 0 0 1 0;
> #P newex 48 244 66 9109513 jit.rgb2luma;
> #P message 208 48 23 9109513 653;
> #P message 165 48 18 9109513 35;
> #P newex 165 21 45 9109513 loadbang;
> #P window linecount 3;
> #P newex 48 191 122 9109513 jit.chromakey @color 0. 1. 0. 0. @mode
> 1 @tol 0.2 @fade 0.1;
> #P number 69 97 35 9 0 0 1 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 165 69 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 208 69 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P toggle 24 98 15 0;
> #P window linecount 1;
> #P newex 24 120 55 9109513 metro 100;
> #P user jit.pwindow 23 314 162 122 0 1 0 0 1 0;
> #P newex 24 153 143 9109513 jit.desktop 1 char @dim 160 120;
> #B color 5;
> #N vpatcher 15 55 615 455;
> #P button 50 57 15 0;
> #P window setfont "Sans Serif" 9.;
> #P newex 162 50 31 9109513 + 120;
> #P newex 119 50 31 9109513 + 160;
> #P newex 50 76 99 9109513 pack rect 0 0 160 120;
> #P inlet 50 37 15 0;
> #P inlet 72 56 15 0;
> #P inlet 94 56 15 0;
> #P inlet 119 30 15 0;
> #P inlet 162 30 15 0;
> #P outlet 50 100 15 0;
> #P connect 5 0 9 0;
> #P connect 9 0 6 0;
> #P connect 6 0 0 0;
> #P connect 4 0 6 1;
> #P connect 3 0 6 2;
> #P fasten 7 0 6 3 124 71 121 71;
> #P connect 2 0 7 0;
> #P fasten 8 0 6 4 167 71 143 71;
> #P connect 1 0 8 0;
> #P pop;
> #P newobj 165 105 66 9109513 p osition;
> #P user panel 193 311 168 129;
> #X brgb 26 0 248;
> #X frgb 0 0 0;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P user panel 20 311 168 129;
> #X brgb 26 0 248;
> #X frgb 0 0 0;
> #X border 1;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P connect 6 0 5 0;
> #P connect 5 0 3 0;
> #P connect 2 0 3 0;
> #P connect 16 0 3 0;
> #P connect 3 0 4 0;
> #P connect 3 0 10 0;
> #P connect 10 0 14 0;
> #P connect 9 0 5 1;
> #P connect 11 0 12 0;
> #P connect 12 0 8 0;
> #P connect 7 0 2 0;
> #P connect 8 0 2 0;
> #P connect 8 0 2 1;
> #P connect 7 0 2 2;
> #P fasten 14 0 15 0 53 290 202 290;
> #P connect 8 0 2 3;
> #P connect 11 0 13 0;
> #P connect 13 0 7 0;
> #P connect 7 0 2 4;
> #P connect 14 0 17 0;
> #P connect 17 0 18 0;
> #P connect 18 0 20 0;
> #P fasten 19 0 18 1 437 364 410 364;
> #P fasten 19 1 18 2 475 368 426 368;
> #P connect 17 1 19 0;
> #P connect 14 0 26 0;
> #P connect 26 0 24 0;
> #P connect 21 0 23 0;
> #P connect 27 0 21 0;
> #P connect 22 0 21 0;
> #P connect 16 0 21 0;
> #P connect 5 0 21 0;
> #P connect 20 0 22 0;
> #P pop;
>
>
> –
> no os preocupeis, que de viejos moriremos todos
> <3.png>


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