Green pixels tracking

alessandro.saccoia's icon

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 :)

Jeremy's icon

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:

Max Patch
Copy patch and select New From Clipboard in Max.

jb

alessandro.saccoia's icon

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

Andrew Benson's icon

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.