Forums > Jitter

cv.jit.label (and cv.jit.blobs.sort) question

October 12, 2007 | 3:49 am

Bonjour Jean-Marc and friends,

first just to say again thank you so much for your excellent objects – I’m getting the hang of them and they work beautifully.
More so thank you for taking the time to help us newer folks to understand how to use them.

My question has to do with cv.jit.label (and cv.jit.blobs.sort)

I have made a happy little engine to route the centroid data so that the tracked object stays sorted and labeled correctly.

however, periodically I ‘loose’ one of my tracked objects and when this lost object is found it gets a new number from cv.jit.label

this interrupts my sorting engine and as such I was wondering if there is a way to reset the so that it begins counting (labeling) the objects again.

the only way I have found to do this is the "My Big Hammer" method where I just keep toggling between modes for the cv.jit.label until it clears out…

in the patch below you can cause the problem intentionally by turning the Ggate off and on – then "My Big Hammer" keeps ‘hitting’ the cv.jit.label until it ‘works right’

I am sure there is a better way – any ideas?

thanks
Jamie

max v2;
#N vpatcher 40 104 1114 727;
#P window setfont "Sans Serif" 18.;
#P window linecount 1;
#P comment 603 53 140 196626 My Big Hammer;
#P window setfont "Sans Serif" 9.;
#P number 790 416 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 790 433 46 196617 select 1;
#P user gswitch2 411 153 39 32 1 0;
#P message 649 106 14 196617 0;
#P newex 649 86 49 196617 delay 50;
#P message 617 106 14 196617 1;
#P button 617 86 15 0;
#P newex 789 397 27 196617 > 3;
#P toggle 617 129 15 0;
#P message 617 148 45 196617 mode $1;
#P outlet 780 522 15 0;
#P outlet 839 522 15 0;
#P outlet 898 522 15 0;
#P message 1044 85 60 196617 clear , bang;
#P message 1076 125 60 196617 clear , bang;
#P newex 765 299 315 196617 jit.matrix 3 float32 1 @usesrcdim 1 @srcdimstart 2 @srcdimend 2;
#P newex 740 263 315 196617 jit.matrix 3 float32 1 @usesrcdim 1 @srcdimstart 0 @srcdimend 0;
#P newex 753 281 315 196617 jit.matrix 3 float32 1 @usesrcdim 1 @srcdimstart 1 @srcdimend 1;
#P user jit.cellblock 510 395 711 448 3 9 3 1 45 17 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 user jit.cellblock 513 470 714 523 3 9 3 1 45 17 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 user jit.cellblock 560 560 761 613 3 9 1 1 45 17 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 user jit.cellblock 764 560 965 613 3 9 1 1 45 17 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 user jit.cellblock 970 561 1171 614 3 9 1 1 45 17 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 newex 780 361 41 196617 jit.iter;
#P newex 824 382 41 196617 jit.iter;
#P newex 868 403 41 196617 jit.iter;
#P user jit.pwindow 19 119 322 242 0 1 0 0 1 0;
#P newex 740 229 106 196617 cv.jit.blobs.centroids;
#P newex 740 206 190 196617 cv.jit.label @charmode 1 @threshold 50;
#N vpatcher 20 74 620 474;
#P window setfont "Sans Serif" 9.;
#P window linecount 0;
#P newex 60 168 111 196617 jit.lcd 4 char 320 240;
#P newex 317 30 48 196617 loadbang;
#P window linecount 1;
#P message 317 52 146 196617 brgb 0 0 0 , frgb 255 255 255;
#N vpatcher 20 74 733 647;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 149 224 37 196617 + 200;
#P window linecount 0;
#P newex 331 80 48 196617 loadbang;
#P newex 55 62 27 196617 b;
#P inlet 55 27 15 0;
#P outlet 149 505 15 0;
#P message 149 479 111 196617 paintoval $1 $2 $3 $4;
#P newex 182 431 30 196617 – 20;
#P newex 149 431 30 196617 – 20;
#P newex 248 431 31 196617 + 20;
#P newex 215 431 31 196617 + 20;
#P newex 149 454 109 196617 pack 0 0 0 0;
#P newex 149 319 74 196617 clip 220. 300.;
#P newex 234 319 68 196617 clip 20. 220.;
#P newex 72 107 32 196617 sel 1;
#P newex 72 85 58 196617 random 20;
#P newex 184 357 31 196617 float;
#P newex 254 357 31 196617 float;
#P newex 234 296 27 196617 + 0.;
#P newex 149 292 27 196617 + 0.;
#P newex 234 216 64 196617 random 200;
#P newex 149 198 64 196617 random 100;
#P newex 454 202 47 196617 * 6.283;
#P newex 388 202 29 196617 * 5.;
#P newex 388 224 76 196617 poltocar;
#P newex 454 182 41 196617 * 0.01;
#P newex 388 182 41 196617 * 0.01;
#P newex 454 161 64 196617 random 100;
#P newex 388 161 64 196617 random 100;
#P connect 24 0 25 0;
#P connect 25 1 13 0;
#P connect 13 0 14 0;
#P connect 26 0 7 0;
#P connect 7 0 27 0;
#P connect 27 0 9 0;
#P fasten 12 0 9 0 189 378 140 378 140 285 154 285;
#P connect 9 0 16 0;
#P connect 16 0 20 0;
#P connect 20 0 17 0;
#P connect 17 0 22 0;
#P connect 22 0 23 0;
#P fasten 4 0 9 1 393 250 171 250;
#P fasten 15 0 21 0 239 400 187 400;
#P connect 21 0 17 1;
#P fasten 25 0 12 0 60 351 189 351;
#P fasten 16 0 12 1 154 346 210 346;
#P fasten 16 0 18 0 154 412 220 412;
#P connect 18 0 17 2;
#P connect 26 0 8 0;
#P fasten 11 0 10 0 259 377 225 377 225 289 239 289;
#P connect 8 0 10 0;
#P connect 10 0 15 0;
#P fasten 15 0 19 0 239 383 253 383;
#P connect 19 0 17 3;
#P fasten 4 1 10 1 459 258 256 258;
#P fasten 25 0 11 0 60 351 259 351;
#P fasten 15 0 11 1 239 344 280 344;
#P fasten 14 0 0 0 77 131 393 131;
#P connect 26 0 0 0;
#P connect 0 0 2 0;
#P connect 2 0 5 0;
#P connect 5 0 4 0;
#P connect 26 0 1 0;
#P fasten 14 0 1 0 77 131 459 131;
#P connect 1 0 3 0;
#P connect 3 0 6 0;
#P connect 6 0 4 1;
#P pop;
#P newobj 224 104 72 196617 p moving_ball;
#N vpatcher 20 74 733 647;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 149 227 37 196617 + 100;
#P window linecount 0;
#P newex 331 80 48 196617 loadbang;
#P newex 55 62 27 196617 b;
#P inlet 55 27 15 0;
#P outlet 149 505 15 0;
#P message 149 479 111 196617 paintoval $1 $2 $3 $4;
#P newex 182 431 30 196617 – 20;
#P newex 149 431 30 196617 – 20;
#P newex 248 431 31 196617 + 20;
#P newex 215 431 31 196617 + 20;
#P newex 149 454 109 196617 pack 0 0 0 0;
#P newex 149 319 74 196617 clip 120. 179.;
#P newex 234 319 68 196617 clip 20. 220.;
#P newex 72 107 32 196617 sel 1;
#P newex 72 85 58 196617 random 20;
#P newex 184 357 31 196617 float;
#P newex 254 357 31 196617 float;
#P newex 234 296 27 196617 + 0.;
#P newex 149 292 27 196617 + 0.;
#P newex 234 216 64 196617 random 200;
#P newex 149 202 64 196617 random 100;
#P newex 454 202 47 196617 * 6.283;
#P newex 388 202 29 196617 * 5.;
#P newex 388 224 76 196617 poltocar;
#P newex 454 182 41 196617 * 0.01;
#P newex 388 182 41 196617 * 0.01;
#P newex 454 161 64 196617 random 100;
#P newex 388 161 64 196617 random 100;
#P connect 24 0 25 0;
#P connect 25 1 13 0;
#P connect 13 0 14 0;
#P connect 26 0 7 0;
#P connect 7 0 27 0;
#P connect 27 0 9 0;
#P fasten 12 0 9 0 189 378 140 378 140 285 154 285;
#P connect 9 0 16 0;
#P connect 16 0 20 0;
#P connect 20 0 17 0;
#P connect 17 0 22 0;
#P connect 22 0 23 0;
#P fasten 4 0 9 1 393 250 171 250;
#P fasten 15 0 21 0 239 400 187 400;
#P connect 21 0 17 1;
#P fasten 25 0 12 0 60 351 189 351;
#P fasten 16 0 12 1 154 346 210 346;
#P fasten 16 0 18 0 154 412 220 412;
#P connect 18 0 17 2;
#P connect 26 0 8 0;
#P connect 8 0 10 0;
#P fasten 11 0 10 0 259 377 225 377 225 289 239 289;
#P connect 10 0 15 0;
#P fasten 15 0 19 0 239 383 253 383;
#P connect 19 0 17 3;
#P fasten 4 1 10 1 459 258 256 258;
#P fasten 25 0 11 0 60 351 259 351;
#P fasten 15 0 11 1 239 344 280 344;
#P fasten 14 0 0 0 77 131 393 131;
#P connect 26 0 0 0;
#P connect 0 0 2 0;
#P connect 2 0 5 0;
#P connect 5 0 4 0;
#P connect 26 0 1 0;
#P fasten 14 0 1 0 77 131 459 131;
#P connect 1 0 3 0;
#P connect 3 0 6 0;
#P connect 6 0 4 1;
#P pop;
#P newobj 148 104 72 196617 p moving_ball;
#P newex 50 71 56 196617 t b b clear;
#N vpatcher 20 74 733 647;
#P window setfont "Sans Serif" 9.;
#P newex 331 80 48 196617 loadbang;
#P newex 55 62 27 196617 b;
#P inlet 55 27 15 0;
#P outlet 149 505 15 0;
#P message 149 479 111 196617 paintoval $1 $2 $3 $4;
#P newex 182 431 30 196617 – 20;
#P newex 149 431 30 196617 – 20;
#P newex 248 431 31 196617 + 20;
#P newex 215 431 31 196617 + 20;
#P newex 149 454 109 196617 pack 0 0 0 0;
#P newex 149 319 62 196617 clip 20. 79.;
#P newex 234 319 68 196617 clip 20. 220.;
#P newex 72 107 32 196617 sel 1;
#P newex 72 85 58 196617 random 20;
#P newex 184 357 31 196617 float;
#P newex 254 357 31 196617 float;
#P newex 234 296 27 196617 + 0.;
#P newex 149 292 27 196617 + 0.;
#P newex 234 216 64 196617 random 200;
#P newex 149 216 64 196617 random 100;
#P newex 454 202 47 196617 * 6.283;
#P newex 388 202 29 196617 * 5.;
#P newex 388 224 76 196617 poltocar;
#P newex 454 182 41 196617 * 0.01;
#P newex 388 182 41 196617 * 0.01;
#P newex 454 161 64 196617 random 100;
#P newex 388 161 64 196617 random 100;
#P connect 24 0 25 0;
#P connect 25 1 13 0;
#P connect 13 0 14 0;
#P connect 26 0 7 0;
#P connect 7 0 9 0;
#P fasten 12 0 9 0 189 378 140 378 140 285 154 285;
#P connect 9 0 16 0;
#P connect 16 0 20 0;
#P connect 20 0 17 0;
#P connect 17 0 22 0;
#P connect 22 0 23 0;
#P fasten 4 0 9 1 393 250 171 250;
#P fasten 15 0 21 0 239 400 187 400;
#P connect 21 0 17 1;
#P fasten 25 0 12 0 60 351 189 351;
#P fasten 16 0 12 1 154 346 210 346;
#P fasten 16 0 18 0 154 412 220 412;
#P connect 18 0 17 2;
#P connect 26 0 8 0;
#P fasten 11 0 10 0 259 377 225 377 225 289 239 289;
#P connect 8 0 10 0;
#P connect 10 0 15 0;
#P fasten 15 0 19 0 239 383 253 383;
#P connect 19 0 17 3;
#P fasten 4 1 10 1 459 258 256 258;
#P fasten 25 0 11 0 60 351 259 351;
#P fasten 15 0 11 1 239 344 280 344;
#P fasten 14 0 0 0 77 131 393 131;
#P connect 26 0 0 0;
#P connect 0 0 2 0;
#P connect 2 0 5 0;
#P connect 5 0 4 0;
#P connect 26 0 1 0;
#P fasten 14 0 1 0 77 131 459 131;
#P connect 1 0 3 0;
#P connect 3 0 6 0;
#P connect 6 0 4 1;
#P pop;
#P newobj 73 104 72 196617 p moving_ball;
#P newex 50 50 52 196617 metro 33;
#P inlet 50 30 15 0;
#P outlet 60 244 15 0;
#P connect 1 0 2 0;
#P connect 2 0 4 0;
#P connect 4 2 9 0;
#P fasten 7 0 9 0 322 148 65 148;
#P connect 6 0 9 0;
#P connect 5 0 9 0;
#P connect 3 0 9 0;
#P connect 4 0 9 0;
#P connect 9 0 0 0;
#P connect 4 1 3 0;
#P fasten 4 1 5 0 78 97 153 97;
#P fasten 4 1 6 0 78 97 229 97;
#P connect 8 0 7 0;
#P pop;
#P newobj 20 76 69 196617 p three_balls;
#P newex 20 98 66 196617 jit.rgb2luma;
#P toggle 20 56 15 0;
#P newex 868 382 305 196617 jit.matrix 1 char 1 @usesrcdim 1 @srcdimstart 2 @srcdimend 2;
#P newex 780 339 302 196617 jit.matrix 1 char 1 @usesrcdim 1 @srcdimstart 0 @srcdimend 0;
#P newex 824 361 305 196617 jit.matrix 1 char 1 @usesrcdim 1 @srcdimstart 1 @srcdimend 1;
#P newex 780 318 151 196617 cv.jit.blobs.sort @threshold 20;
#P newex 868 473 40 196617 gate 3;
#P newex 824 473 40 196617 gate 3;
#P newex 780 473 40 196617 gate 3;
#P user panel 595 48 172 108;
#X brgb 255 197 75;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P window setfont "Sans Serif" 18.;
#P comment 371 199 133 196626 Trouble Maker;
#P user panel 362 131 148 107;
#X brgb 255 26 9;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P connect 10 0 12 0;
#P connect 12 0 11 0;
#P connect 11 0 15 0;
#P fasten 15 0 39 1 25 371 349 371 349 121 445 121;
#P connect 14 0 23 0;
#P connect 6 0 22 0;
#P connect 3 0 21 0;
#P connect 4 0 21 0;
#P connect 5 0 21 0;
#P fasten 40 0 35 0 795 368 754 368 754 80 622 80;
#P connect 35 0 36 0;
#P connect 36 0 33 0;
#P fasten 38 0 33 0 654 125 622 125;
#P connect 33 0 32 0;
#P connect 35 0 37 0;
#P connect 37 0 38 0;
#P fasten 39 1 13 0 445 190 745 190;
#P fasten 32 0 13 0 622 183 745 183;
#P connect 28 0 13 0;
#P connect 13 0 14 0;
#P connect 28 0 14 0;
#P connect 14 0 25 0;
#P connect 28 0 25 0;
#P connect 14 0 24 0;
#P connect 28 0 24 0;
#P connect 3 1 20 0;
#P connect 4 1 20 0;
#P connect 5 1 20 0;
#P connect 14 0 26 0;
#P connect 28 0 26 0;
#P connect 14 0 6 0;
#P connect 27 0 6 0;
#P connect 6 0 8 0;
#P connect 27 0 8 0;
#P connect 8 0 18 0;
#P connect 18 0 3 0;
#P connect 3 0 31 0;
#P connect 4 0 31 0;
#P connect 5 0 31 0;
#P connect 16 0 34 0;
#P connect 17 0 34 0;
#P connect 18 0 34 0;
#P connect 34 0 41 0;
#P connect 41 0 40 0;
#P fasten 25 0 3 1 745 467 815 467;
#P connect 6 0 7 0;
#P connect 27 0 7 0;
#P connect 7 0 17 0;
#P connect 17 0 4 0;
#P connect 3 1 30 0;
#P connect 4 1 30 0;
#P connect 5 1 30 0;
#P fasten 24 0 4 1 758 463 859 463;
#P connect 6 0 9 0;
#P connect 27 0 9 0;
#P connect 9 0 16 0;
#P connect 16 0 5 0;
#P fasten 26 0 5 1 770 459 903 459;
#P connect 3 2 29 0;
#P connect 4 2 29 0;
#P connect 5 2 29 0;
#P connect 3 2 19 0;
#P connect 4 2 19 0;
#P connect 5 2 19 0;
#P pop;


November 7, 2008 | 8:09 am

im very confused by your patch.
maybe I am just really new.
do you think you can add comments labeling what the numbers are?

thanks


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