Forums > Jitter

Green pixels tracking

June 2, 2006 | 1:57 pm

Hello,
I’ve been trying out every jitter example but I can’t figure out how to
solve this. Basically I need to track the number of pixels of a certain RGB
value (say green) within a certain treshold (green- and green+) and to see
the percentage of this number on the whole matrix to trigger a
jit.recordwhen this percentage is above 30%. Would you give me a
starting idea on how
to track the number of pixels of a certain color? Thank you very much.
Ale

P.S. for who is looking for a cheap tv card that works in jitter I just
bought a Hauppauge wintv-hdr 1100 and with jit.QT.grab and the abstract
plane vdig component works great, while with the jit.DX.grab there is some
flickering if I don’t leave amcap open in the foreground :s anyway this
product works well with jitter :)


June 2, 2006 | 2:21 pm

You need to think about the problem a little differently. Instead of
thinking about tracking green in an otherwise complex image, you
could think about tracking white against a black image (which would
be easier, since you could use a histogram or the mean to easily
detemine your 30%).

So, then the problem is – how to turn a range of green to white?
jit.chromakey in mode 1 is probably the simplest.

Here’s a sample patch:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 26 492 63 196617 jit.unpack 1;
#P flonum 590 568 65 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 576 542 53 196617 jit.3m;
#P number 238 628 105 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 238 604 43 196617 jit.spill;
#P newex 238 578 324 196617 jit.matrix 1 long 1 @usesrcdim 1
@srcdimstart 255 @srcdimend 255;
#P newex 238 540 182 196617 jit.histogram 1 long 256 @autoclear 1;
#P user jit.pwindow 25 530 162 122 0 0 0 0 1 0;
#P newex 440 155 99 196617 pak color 0. 0. 0. 0.;
#P newex 484 128 83 196617 vexpr $f1/255.;
#P user suckah 88 188 333 250;
#P user jit.pwindow 93 193 322 242 0 1 0 0 1 0;
#P newex 26 469 270 196617 jit.chromakey @mode 1 @tol 0.1 @minkey 1.
@maxkey 0.;
#P toggle 62 40 15 0;
#P newex 78 40 52 196617 metro 20;
#P message 111 67 83 196617 read dishes.mov;
#P newex 88 97 105 196617 jit.qt.movie 320 240;
#P window linecount 2;
#P comment 244 646 100 196617 abs number of matching pixels;
#P window linecount 5;
#P comment 593 589 100 196617 mean of image ; at 255 , the image
would be completely white , so > 76.5 is 30% matching.;
#P window linecount 4;
#P comment 434 212 100 196617 click on image to choose a color to
match (chromakey tolerance is 0.1);
#P connect 17 1 18 0;
#P connect 19 0 12 0;
#P connect 7 0 19 0;
#P fasten 12 0 13 0 31 662 220 662 220 532 243 532;
#P fasten 12 0 17 0 31 673 566 673 566 537 581 537;
#P connect 13 0 14 0;
#P connect 14 0 15 0;
#P connect 15 0 16 0;
#P connect 3 0 7 0;
#P connect 3 0 8 0;
#P fasten 11 0 7 0 445 179 349 179 349 143 31 143;
#P connect 10 0 11 2;
#P fasten 9 0 10 0 93 447 432 447 432 128 489 128;
#P connect 6 0 5 0;
#P connect 5 0 3 0;
#P connect 4 0 3 0;
#P window clipboard copycount 20;

jb


June 2, 2006 | 3:00 pm

Thanks a lot!
I will use your approach, but before it would be nice to do a shader who
just lets pass the pixels of a given value and sets the other to black. I
can do that kind of things in a shader with much less effort, right?
Then I can count the pixel number with histogram and spill, trigger the
jit.record and record the actual output of jit.slab which is already
processed. Ciao
Ale


June 2, 2006 | 3:20 pm

Hi Alessandro,
jit.gl.slab is probably not the way to go for analysis procedures. From
the sounds of it, what you are looking for is the jit.op object,
especially the logical operators (>,< ,

p,=). > and < ops will output
a binary (black/white) image that can then be sent on to jit.3m.

Cheers,
Andrew B.


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