Hi I am new to using PureData and I am looking for my help. I am trying to take a video file, currently one from the harddrvie but eventually a streaming feed, and look at each pixel in each frame and consider the RGB values of the pixels. I want to then look at those values and calculate a ratio of R-G and G-B and then determine what color I would like to change that pixel based on the ratio. I believe I have found a good way to get the data of the pixel, by taking a metro and a counter with the width and height of the video and divinding by the width and and height and stepping through the frame and send it to pix_data. i unpack the RGB values and calculate the ratio i need. I am having trouble changing the pixel value to the color i want. I am looking for some insight on the best way to approach this, or if there is a better way to do it from scrath, or if you think it would be more efficient to use another program and if you all know of any other programs. Thank you for your help. ~Sean
On Mon, 14 Jun 2010, Sean Harrigan wrote:
Hi I am new to using PureData and I am looking for my help. I am trying to take a video file, currently one from the harddrvie but eventually a streaming feed, and look at each pixel in each frame and consider the RGB values of the pixels. I want to then look at those values and calculate a ratio of R-G and G-B and then determine what color I would like to change that pixel based on the ratio.
Is that R minus G and G minus B ? then you can do that using [pix_colormatrix] in GEM or [#inner] in GF. for example :
[#inner (3 2 # 1 0 -1 1 0 -1)]
will turn a 3-channel picture into a 2-channel picture where the first channel is R-G and the second channel is G-B. you can also do it with two separate outputs like :
[#inner (3 1 # 1 -1 0)] because R-G = 1*R + -1*G + 0*B [#inner (3 1 # 0 1 -1)] because G-B = 0*R + 1*G + -1*B
In GEM, it's similar except that you have limitations on numbers of channels and range of values and you have to initialise your object the long way and you can't use that class of object for any other purpose than that.
I am looking for some insight on the best way to approach this, or if there is a better way to do it from scrath, or if you think it would be more efficient to use another program and if you all know of any other programs. Thank you for your help. ~Sean
It depends on how efficient it needs to be.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801