Average value of a matrix?

Quadratic Equation's icon

I'm looking to take the average RGB value of a matrix, presumably by taking the sum of all cells divided by the number of cells. The problem is that, as you know, each cell is (presumably) a list of four (ARGB) chars. I presume therefore I need to sum the four plane values together, then peform the aforementioned operation.

Any clues as to how to go about this? Realising algorithms in dataflow languages does my head in. I'm just looking for a scalar, color average of an entire matrix.

Emmanuel Jourdan's icon

On 10 avr. 07, at 18:06, Serge wrote:

> I'm looking to take the average RGB value of a matrix, presumably
> by taking the sum of all cells divided by the number of cells. The
> problem is that, as you know, each cell is (presumably) a list of
> four (ARGB) chars. I presume therefore I need to sum the four plane
> values together, then peform the aforementioned operation.
>
> Any clues as to how to go about this? Realising algorithms in
> dataflow languages does my head in. I'm just looking for a scalar,
> color average of an entire matrix.

Did you look at jit.3m?

ej

Wetterberg's icon

Try jit.3m on for size.

Andreas

Serge skrev:
> I'm looking to take the average RGB value of a matrix, presumably by taking the sum of all cells divided by the number of cells. The problem is that, as you know, each cell is (presumably) a list of four (ARGB) chars. I presume therefore I need to sum the four plane values together, then peform the aforementioned operation.
>
> Any clues as to how to go about this? Realising algorithms in dataflow languages does my head in. I'm just looking for a scalar, color average of an entire matrix.
>
> .
>
>