[PD] Video Processing

Mathieu Bouchard matju at artengine.ca
Mon Jun 14 20:25:16 CEST 2010

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 

> 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

More information about the Pd-list mailing list