Forums > Jitter

detecting presence of particular colors

April 17, 2007 | 6:05 am

Hello,
I’m trying to make a patch that lets me hold up, say, a red apple, and get a particular message, and then, say, a green apple, and get a different message. I want to define multiple colors (four), and then continuously and simultaneously test for presence or absence. I’ve been getting some results using tap.jit.colortrack, and then measuring change above a certain threshold. However, I’m wondering if anyone has a robust way of accomplishing this that they’d like to share.

thanks!,
Michael


April 17, 2007 | 4:15 pm

actually, this awesome patch by nesa (posted in another thread which my search terms didn’t find initially) does the trick. nesa, whoever/wherever you are, the first drink is on me!

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#N vpatcher 177 250 777 650;
#P window setfont "Sans Serif" 9.;
#P newex 156 178 34 196617 zl len;
#P comment 247 163 167 196617 the rest are always zeroes;
#P comment 247 147 167 196617 have meaningfull values;
#P newex 50 74 43 196617 jit.spill;
#P newex 50 106 52 196617 t b l;
#P newex 128 252 27 196617 + 1;
#P newex 50 194 25 196617 iter;
#P newex 50 315 55 196617 zl group 8;
#P newex 50 218 88 196617 t b i;
#P newex 50 284 88 196617 zl nth;
#P newex 50 256 52 196617 zl reg;
#P newex 50 171 36 196617 zl reg;
#P inlet 50 25 15 0;
#P inlet 76 138 15 0;
#P outlet 50 337 15 0;
#P comment 247 131 243 196617 only cells with coordinates from lut list;
#P connect 3 0 12 0;
#P connect 12 0 11 0;
#P connect 11 0 4 0;
#P connect 4 0 9 0;
#P connect 9 0 7 0;
#P connect 7 0 5 0;
#P connect 5 0 6 0;
#P connect 6 0 8 0;
#P connect 8 0 1 0;
#P connect 2 0 4 1;
#P connect 11 1 5 1;
#P fasten 15 0 8 1 161 311 100 311;
#P connect 7 1 10 0;
#P connect 10 0 6 1;
#P fasten 2 0 15 0 81 163 161 163;
#P pop;
#P newobj 452 211 144 196617 p histogram list filter;
#P comment 327 393 50 196617 256 hues;
#P message 247 65 91 196617 read dvducks.mov;
#P message 233 42 76 196617 read bball.mov;
#P user multiSlider 452 245 179 163 0. 32000. 8 2664 15 0 0 1 8 66 0;
#M frgb 248 0 0;
#M brgb 0 0 0;
#M rgb2 127 127 127;
#M rgb3 0 0 0;
#M rgb4 248 139 0;
#M rgb5 255 229 8;
#M rgb6 46 223 25;
#M rgb7 24 251 255;
#M rgb8 11 9 223;
#M rgb9 193 32 216;
#M rgb10 220 12 12;
#P newex 452 181 131 196617 jit.histogram @autoclear 1;
#P newex 342 34 48 196617 loadbang;
#B color 6;
#P user jit.pwindow 271 266 162 122 0 1 0 0 1 0;
#P newex 342 91 52 196617 jit.fill lut;
#P message 342 61 145 196617 0 26 40 80 124 167 211 255;
#P newex 342 119 111 196617 jit.matrix lut 1 char 8;
#P newex 122 180 62 196617 jit.charmap;
#P button 64 59 15 0;
#P newex 108 234 58 196617 jit.hsl2rgb;
#P newex 108 210 53 196617 jit.pack;
#P newex 108 150 66 196617 jit.unpack;
#P newex 108 126 58 196617 jit.rgb2hsl;
#P flonum 183 39 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 183 59 42 196617 rate $1;
#P flonum 142 39 35 9 0.5 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 108 39 15 0;
#P newex 108 59 51 196617 qmetro 2;
#P newex 108 96 142 196617 jit.qt.movie 320 240 @vol 0.;
#B color 5;
#P comment 172 393 50 196617 8 hues;
#P user jit.pwindow 107 266 162 122 0 1 0 0 1 0;
#P comment 400 41 335 196617 hand-picket hues (red-orange-yellow-
green-cyan-blue-magenta-red);
#P comment 634 249 100 196617 red and ‘hueless’;
#P connect 6 0 5 0;
#P fasten 24 0 4 0 252 93 113 93;
#P fasten 23 0 4 0 238 90 113 90;
#P connect 14 0 4 0;
#P fasten 5 0 4 0 113 89 113 89;
#P fasten 8 0 4 0 188 86 113 86;
#P connect 4 0 10 0;
#P connect 10 0 11 0;
#P connect 11 0 12 0;
#P connect 12 0 13 0;
#P connect 13 0 2 0;
#P connect 11 1 15 0;
#P connect 15 0 12 1;
#P connect 11 2 12 2;
#P connect 7 0 5 1;
#P connect 11 3 12 3;
#P connect 16 0 15 1;
#P connect 9 0 8 0;
#P fasten 4 0 19 0 113 117 277 117;
#P connect 20 0 17 0;
#P connect 17 0 18 0;
#P connect 18 0 16 0;
#P fasten 15 0 21 0 127 202 444 202 444 172 457 172;
#P connect 21 0 26 0;
#P connect 26 0 22 0;
#P fasten 17 0 26 1 347 84 591 84;
#P window clipboard copycount 27;


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