We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › mapping what happens on screen to a matrix
Page Index Toggle Pages: 1
mapping what happens on screen to a matrix (Read 701 times)
mapping what happens on screen to a matrix
Jul 21st, 2009, 2:21pm
 
I am using processing to control a hardware matrix of rgb leds. Each led is basically addressed with an X,Y coordinate and an RGB value.

I making different graphic apps in Processing that I want to map to this hardware rgb matrix.

I am not sure what the terminology is for what I want to do.

I basically want to quantize what is happening on screen and at a higher resolution (like video) to a lower resolution and store all the values.

My initial matrix is only 5x5 so I just need to constantly store a new set of 25 rgb values and then transmit them to the device.

any tips for doing this?

I am guessing I can use the pixels[] array to get the screen values but what is a good algorithm for reducing the resolution in an efficient way?
What I mean is if a square in the original is 50x50 pixels and this would be reduced to one pixel in the matrix, how do I determine the color to use from within that square of 50x50? Take an average of all the other values?
Re: mapping what happens on screen to a matrix
Reply #1 - Jul 22nd, 2009, 1:01am
 
You can cook your own quantization algorithm, there are lot of different methods available. Or you can start by just using image() with width & height parameters.
Re: mapping what happens on screen to a matrix
Reply #2 - Jul 22nd, 2009, 7:02am
 
PhiLho  wrote on Jul 22nd, 2009, 1:01am:
You can cook your own quantization algorithm, there are lot of different methods available. Or you can start by just using image() with width & height parameters.


I thought about using image but then if I have an animation I would have to save the frame to disk each time I wanted to read it as an image and scale it down. Is there a way I can do this in ram instead
Re: mapping what happens on screen to a matrix
Reply #3 - Jul 22nd, 2009, 8:07am
 
You dont have to save it to disk, you can use http://processing.org/reference/PGraphics.html instead...
Re: mapping what happens on screen to a matrix
Reply #4 - Jul 22nd, 2009, 8:47am
 
Dices thread can be inspiring too...
Page Index Toggle Pages: 1