Looking up a colour value in a still image/jitter matrix
I’m writing a patch for visuals for a performance piece, where I want specific pixels in a still image to show depending on the audio.
For the moment, I have a patch working using analyzer~ and feeding of three different sinusoidal components of frequency to determine the RGB values to search for, and they are scaled accordingly.
Currently, using a jit.op with [pass == == ==] as the argument seems to be providing good results.
However, from re tracing my patch, what I believe it to be doing is searching for one value in the Red plane. When it finds a value that equals the number generated by analyzer~, it sends it to the jitter matrix, then off to the window, and it displays.
At the same time, its doing the same thing for the Green and Blue planes.
Consequently, the image pixels never looks like the original image pixels. Its quite interesting none the less! And will be used at a later date, the joys of experimenting!
However, if I wanted to search though a jitter matrix for one location that had a specific colour, for example R=255 G=255 B=255, and display only that colour pixel in the next matrix, what would I use?
I seem to be giving it headaches with a very convoluted jit.iter patch… :(
From what you say, It sounds like each plane is getting compared independently of any other plane – which makes sense. If you persist with this method you will need some logical comparison to check that *all* 3 planes are outputting their respective matched value before any output is allowed. (Value R & Value G & Value B)
A couple of alternate strategies: either combine the three planes into a single 24 or 32 bit value and then search for the specific RGB value in that format, or alternately it could be done using jit.expr – Where the value for every plane is matched to your criteria before the output is true. – if you can determine the correct expression.
There may a simpler way but it hasn’t occurred to me while replying.
I figured I was up to the stage on constructing logic, and was looking into various functions in zl to see if that would help. Perhaps its time I jump into the deep end and start understanding the logic required work jit.expr.
In regards to converting three planes into a 24 or 32 bit value, and then searching for that value, how does this process work? Recommendations of objects would be great, as I’m a little lost on this concept! I think I’ve seen this used in a type of coll storage situation, but it did baffle me a little as to how it worked.
And on the note of coll, am I right to assume that this is a little basic for my needs?
Sorry for all the question, I’m a little new to the idea of storing data as lists, and retrieving data from those lists :)
I ended up using a collection of jit.ops. – 3 to test for the specific R G and B values and another 3 to logically AND the results of each colour plane. The problem I see with this is that the result is very "binary" pixels are eeither active with the precise RGB value, or they aren’t- you may be better placed looking for a range of values rather than just one specific value but this is more an aesthetic issue and it is what I understand you were looking to get.
There is a suckah object above the top window to select the colour – Interestingly this Suckah didn’t work properly on my second monitor – giving different values to those expected – which had me looking for a logical problem for some time where there wasn’t! – DOH! – I suspect this comes back to the colour profile set on the monitor. Traps for players (and people with dodgy color vision).
If this what you are after you won’t need to convert to a 32 bit long) value – which means packing the ARGB values from each plane of a 4 plane matrix into a single 32 bit integer (search for "ARGB Java" to find out how) As far as using colls in this context – I can’t see its any advantage over using jitter objects.
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 1065.3oc0ZtsiSCCDF951mhnbAWfVp73C4.RHAOGHDJsIz0PNTZbYW.w6N9P Ba2haiCMIMnUMQ1IM8e9lwyX6r+b4B+0UOlU668Zu26sXwOWtXgtKUGKZZuv uH4wM4I05ayu9vlujbu+clKwS0cVs9yuhRZ6bSUwtDAeMOmK9t55PyEJOTvK yyD0mzY0Awo8tt5PYZQUZ1wcZtOw22kYTruu2GZtj7Gby87xsebe1Fg4pX.V gtyKNVcj.QpSXh7j2GTemesbo5vcNZ2RYtNauE6lgZ67SUkhxjBs37e2ddRt +kLb0sWy+gwBQR0YiG3yY57Rg+cd9qSJ2dQJvvF6OBoOQUGgAGBz3YMDHwLs 0GhMrXjfP3rFB3.v.A5P.grGjlbqUIxdT+i3enbWxlu3Ap+rPHBdLIDoCBcz IW3DUOhAGEbUf5ybwpcOvKSqdvFP.e2yMd1H.kU4TpvnmkJLbULMlEw9mrqh r55jsY+UDv9rjTKFJf5aFBrMWOrhEyfnvKV6nekI.hN2PSZR7U4rOGTpEU6r AE.MSgBFcLTPiDTR1KrREXtFpDBGQE3pnxmxqjRxp4OHIIun4e1LIRUkXoZh XOudSRt9tPqhu.g.c1Rh5.yj+Do.Ty2PJZdgzp0OF1+.0DUa2lmYkZD+9OKS qUJtTDPyDHzFFzdbHKf90hLw9J4PNq1H81MvnyoWXPCVWaIf7jqe3XipT5WE qJp9FOSloF4go1wTvsa.jTierHQNd4wNKJalSpAafgaiAwp148V4mW7BKnBG LDAT39Ni0d.IfEpykzjskQuIXhM2wDNVyGZX7SK4cxoD7eRvTCk.BZjwzadi 2a+VRt0kBAgycZQw5DTTrYOCvjaIsHy+QfnmQqqKQ0kW0XzjrnQS8o.vrwQX yfE534+eoEKc1WeJVOeWVftJdzsLgBc9m8MvLBIXDymH7x8xssQKCwTB6Mcb L7AiahhVwFmvmlskiZqp8XBFlagMt2picxwrylAl8q.rOZT+D7y4km9dOzOQ U+Omw0UG1uoU2sUt8dZMsoY0BdYhfWUdzMolxnG7ma5ddZZl95n+rT3zcUxk a1HBpT6RmOMf1ta8ssNSrfqpU5e8HcH1SrnNEqZ6DCk5iXBeaztt0.nVbWpk zO0BQ5o6QAyBTkSNl0z5JEq5M+zYffls8HP3J0zIv4LAmvLTSr94UuRModgU c66HSJmvO6WytjnSKkbIUGcRgD0036oiR5MbpSQQlTModSac64BmdM0Y.d7z qotp3bRh9QOD2k7km3fG8bStDhGLsoKAWREDLsXh4pllNNQbzyMcTxkXonoM MfCYlvywhJSckNWJ+dpz6TUQfZJ4l+sK.DsswUKVhShkNwHD6rplvonCvX3X Ay5XYQG4YYQCfmEMFpECzQQsn3QgsTGTqrwuV9a.j1s4H -----------end_max5_patcher-----------
I see what you mean. I just wanted to see exactly what it would do I guess :)
How do I search for a range of values instead? As in within a particular threshhold?
My knowledge of language for jit.op is pretty limited, I guess with the ‘logic’ calculations. Also, would you be able to explain the difference between an argument and an ‘@’ argument?
i guess you need to change the @op == for @op < or @op > and play with the paremeter..
btw theres another method to do similar task with jit.expr…
but be ready, jit.expr realms are somehow dark… still to me…
i did a small explantation in the patch…
isnt a perfect method because the color components, but you can develop the expression to be more precise using more operations and thersholds..
----------begin_max5_patcher---------- 1086.3oc4XssiaaCD8YGf7OLP.Mvafqgnt6hhBDfVf9Pw1W5KEqLBjsn8x.I RAI5tNMH+6kW7EsdsrjkjW6j9hjI4XNm4vC4LTe4suYfwL1ZbgA7SvCvfAeQ zy.UexdFrsiAFoQqmmDUnLzfhehM6SFi1LFGulq5OgEEmhKJ.ywt6Fkshmf4 7Om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M vry0Q41ncUGpues.m+kAbaVfQNNkOnR1p+fMpQvFcNv1yTcNvFX6Y51uvVdG +KAau4HfKEaqfcyXaqyB1SJy1SrP8LrMazounqyFuIMRJ3eU.m7y1VO3Btgw lc6JrxWIAC1869YotI.95nBaz4QGVJa8Xa6APdpW6azOXtQUVitNkoFbYHzW fMYGhW+GNe0ct -----------end_max5_patcher-----------
Wow… that may take me sometime to understand Carsol!
But thanks for posting! Shall have a tweak and a play and see what happens, many thanks!
Forums > Jitter