Color tracking

Nov 15, 2007 at 2:54pm

Color tracking

Hi!

I’m a newbie trying to figure out the color tracking part of JITTER.
I managed to put together a patch but it doesn’t work yet. That’s why i need your help with (or maybe if there’s a better way to do it please tell me)
What i want is the following;
If the color red is banged in the right half of the webcam screen a quicktime movie has to be played. I’m stuck right now and don;t know what the next move should be.
The patch i have contains a bit of color tracking but I cannot seem to get the patch to bang when the color red appears and let a video play. Can anyone hlpe me out with this one?

cheers, William

max v2;
#N vpatcher 447 169 1263 957;
#P user jit.pwindow 389 330 274 206 0 1 0 0 1 0;
#P user jit.pwindow 181 220 180 141 0 1 0 0 1 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 622 197 24 196617 r lp;
#P newex 585 199 24 196617 r lp;
#P newex 173 371 67 196617 unpack 0 0 0;
#P user swatch 2 456 128 32;
#P message 199 706 24 196617 s lp;
#P message 137 703 24 196617 s lp;
#P newex 219 670 27 196617 +;
#P newex 143 670 27 196617 +;
#P number 162 634 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 219 636 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 128 601 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 188 601 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 134 538 71 196617 jit.findbounds;
#P newex 162 500 95 196617 pak max 1. 0. 0. 0.;
#P number 274 406 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 162 405 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 220 406 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 138 562 58 196617 unpack 0 0;
#P newex 422 260 111 196617 jit.lcd 4 char 320 240;
#P newex 526 229 84 196617 pack moveto 0 0;
#P newex 427 227 81 196617 pack write RED!;
#P newex 398 177 137 196617 t b b b l;
#P newex 173 185 120 196617 jit.brcosa @saturation 3;
#P newex 169 152 98 196617 jit.qt.grab 320 240;
#P message 243 118 30 196617 open;
#P newex 172 116 46 196617 metro 2;
#P toggle 182 74 15 0;
#P connect 11 0 23 0;
#P connect 10 0 23 1;
#P connect 12 0 23 2;
#P connect 9 0 16 0;
#P connect 4 0 14 0;
#P connect 13 0 14 0;
#P connect 19 0 21 0;
#P connect 14 0 9 0;
#P connect 16 0 19 0;
#P connect 18 0 19 1;
#P connect 24 0 11 0;
#P connect 2 0 3 0;
#P connect 1 0 3 0;
#P connect 0 0 1 0;
#P connect 3 0 4 0;
#P connect 27 0 24 0;
#P connect 4 0 27 0;
#P connect 9 1 15 0;
#P connect 20 0 22 0;
#P connect 11 0 13 2;
#P connect 15 0 20 0;
#P connect 24 1 10 0;
#P connect 10 0 13 3;
#P connect 17 0 20 1;
#P connect 12 0 13 4;
#P connect 24 2 12 0;
#P connect 8 0 28 0;
#P connect 3 0 5 0;
#P connect 7 0 8 0;
#P connect 5 3 8 0;
#P connect 5 0 8 0;
#P connect 5 1 6 0;
#P connect 5 2 7 0;
#P connect 25 0 7 1;
#P connect 26 0 7 2;
#P pop;

#34616
Nov 16, 2007 at 7:09pm

Hi, find bounds may not be quite what you are looking for. If you are just doing basic color recognition that prints when you show it a red card try this. If you are looking for something that gives you the boundaries of the largest red blob, I’m not entirely sure how to do that yet (working on it myself). I hear Cyclops does color tracking but I’m trying to build something myself.

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 317 397 136 196617 print “I see this much red!!”;
#P newex 316 365 40 196617 change;
#P flonum 320 303 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 241 328 27 196617 +;
#P newex 240 306 27 196617 / 2;
#P newex 240 281 27 196617 +;
#P flonum 249 379 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 205 355 54 196617 split 1 50;
#P user jit.pwindow 46 301 82 62 0 1 0 0 1 0;
#P message 304 102 33 196617 close;
#P newex 107 141 98 196617 jit.qt.grab 320 240;
#P message 181 107 30 196617 open;
#P newex 110 105 46 196617 metro 2;
#P toggle 120 63 15 0;
#P flonum 263 259 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 224 259 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 185 259 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 2;
#P comment 148 295 46 196617 mean red in image;
#P window linecount 1;
#P newex 146 228 129 196617 unpack 0. 0. 0. 0.;
#P newex 599 244 30 196617 print;
#P newex 113 201 107 196617 jit.3m;
#B color 5;
#P comment 294 282 100 196617 tolerance;
#P connect 20 0 21 0;
#P connect 15 0 20 0;
#P connect 18 0 14 2;
#P connect 17 0 18 0;
#P connect 19 0 18 1;
#P connect 5 0 14 0;
#P connect 14 1 15 0;
#P connect 16 0 17 0;
#P connect 6 0 16 0;
#P connect 7 0 16 1;
#P connect 11 0 13 0;
#P connect 12 0 11 0;
#P connect 10 0 11 0;
#P connect 9 0 11 0;
#P connect 8 0 9 0;
#P connect 11 0 1 0;
#P connect 1 1 3 0;
#P connect 3 1 5 0;
#P connect 3 2 6 0;
#P connect 3 3 7 0;
#P connect 1 3 2 0;
#P window clipboard copycount 22;

#117157

You must be logged in to reply to this topic.