RGB Data from Image

    Dec 21 2009 | 9:09 pm
    I am trying to extract RGB data from an image that I can convert to waveform or frequency data. I am probably going about this the wrong way but the patch below is what I have done so far (not much).
    What I am not sure about with this is the (x y)coordinates. The pic I used is only 144 x 162 in Photoshop but the (x y) coordinates continue beyond those ranges. How can I get these two to correspond? Also, if you know of a better way to go about this let me know =)

    • Dec 23 2009 | 7:21 pm
      here's one way among many to do this with jitter:
    • Mar 08 2010 | 8:42 pm
      Sorry i haven't responded to any of this yet. Your patch is very helpful. To take this further what I'd like to do is be able to send out a series bangs or something to grab the RGB values along the x/y axis. One thought I have had is to use UZI to bang across the x axis and then drop a line then do it again until the entire image has been analyzed that way. My problem is that I do not see what I can use to do that with. Is there an object or something that will allow me to control it as per coordinates using UZI or something like it? I am thinking of a pointer or something of that sort. I know this is kind of vague but I am struggling with this as I do not know Jitter very well at all (I know you're very surprised =) )
    • Mar 09 2010 | 9:04 pm
      If I may also add to this the Tutorial 11 seems to look like what I am after, though I am not so sure. I'd like to be able to extract the RGB into a table just like this so I can export that and then analyze it in another program. I am just not sure how to get the individual data from each pixel (e.g. 320 x 2490) image into the table.
    • Mar 09 2010 | 9:26 pm
      not sure if im misunderstanding here, but jit.cellblock is a table you can store planes of an image in, have you looked at that?
    • Mar 09 2010 | 9:57 pm
      Yes, that is what I am talking about. I'd like to be able to get the data from the image (in this a .jpg or similar file) and into jit.cellblock. My problem is I cannot do this with very much accuracy using my mouse to click on the image (in a 320 x 240 image that comes to 76,800 clicks!). What I'd like to do is automate it so that I can get the data from each pixel in a left to right motion and then when I reach the end of the image drop down a line and then do the same.
    • Mar 09 2010 | 10:02 pm
      Maybe this is just to unwieldy. I don't know. I am trying to do some color analysis on the image. maybe there is a better way to do this.
    • Mar 09 2010 | 10:27 pm
      otherwise simple getcell message to jit.matrix.
    • Mar 09 2010 | 10:35 pm
      "Yes, that is what I am talking about. I'd like to be able to get the data from the image (in this a .jpg or similar file) and into jit.cellblock."
      simply just put a jitter matrix going into jit.cellblock then... you'll have all the data for each pixel there in a table.. as shown in this example below. this is only showing a 10x10 matrix (change the argument of jit.matrix to change the size) for ease of explanation, use importmovie to load an image into the jit.matrix. beware it will be greyscale (1 plane). if you want to do processing on R G and B values, then pass only that colour channel from an original 4 plane jitter matrix and then do this. you can just jit.op @pass to pass a specific channel of a matrix i think.
      a jit.cellblock can also be linked to a coll, which you may find of use
    • Mar 10 2010 | 4:30 pm
      Thanks the_man361! That looks like what I need to do.
      I need to do some study again about planes and matrices again so i can know what is going on and how to get the RGB values in there =)
      A question though, what does each of the numbers in the jit.cellblock represent? Is there a table they correspond to?
    • Mar 10 2010 | 6:11 pm
      Your idea of jit.iter is also helpful. That seems to really get at it. I need to figure it all out now. As I play with it I am not sure why certain actions don't work and kinds of data are being output, etc. Thanks. I may be chekcing back in.
    • Mar 10 2010 | 11:34 pm
      no worries. each number in the jit.cellblock represents the value of the corresponding pixel.
      since i converted RGB to luminescence (greyscale) in that patch i sent (one plane, brightness) the jit.cellblock shows brightness of each pixel. if you load an image with some bright and some dark in it to that cellblock you should see it... 255 is totally white, 0 is black.
      if you want to do the same thing for R,G and B, then pass only that channel as one plane in jitter and do the same thing there (eg 255 will be totally red, 0 will be black).
      this may not be of so much learning use, and im sure its a terrible way to patch (i didnt spend any time thinking about what i wanted to do or managing my patch in any way at all) but here is a patch that scans an image, looking for the average brightness value in an 8x8 window in R, G, B and brightness and sonifies the result very basically using 4 sawtooth oscillators (its not meant to sound nice).
      this patch is badly made and everything, but it might give you an idea in this kind of area. you'll need to save it an re-open it when youve downloaded it so that the loadbangs work. then pop it into presentation mode and load an image using 'loadmovie' then hit go and admire the horror. its very much work in progress, and doesnt do anything like what i originally thought would be cool to bash out one evening
    • Jan 04 2017 | 5:20 pm
      thanks so much rob for mentioning jit.iter, you saved a life
    • Jun 15 2017 | 12:43 am
      How did you go @artmusicsouth? I'm trying to do similar kinds of things. I am really wanting to find a way to output the average value of multiple RGB values from an image or frames of video.
    • Jun 15 2017 | 7:34 am
      Take a look at jit.3m for averaging.
    • Jun 15 2017 | 7:53 am
      Thanks Max Gardener! Any recommendations or patches for rgb, HSL or HSV to audio frequency and vice versa? What are your main interests for MAX?