Average RGB values of 200 parts of a video frame

Jeremie's icon

Hi,
I need to collect the average RGB values of 200 parts of a video frame.
I use a poly~ object with 200 instances.
Inside this poly~, I use jit.submatrix to separate a part of the frame and then j3m give me the average RGB. This is sent in a another matrix and I collect those values outside the poly~.
That almost works :)
This process is too heavy and runs very slowly.

I can't find another way to do this.
Does anyone have another solution?

Thanks.

Jérémie

Max Patch
Copy patch and select New From Clipboard in Max.

Here the poly~, maybe it will be clearer even if this is not the solution :

djlbe's icon
Max Patch
Copy patch and select New From Clipboard in Max.

not sure if this is what you are seeking for

Jeremie's icon

Thank you but unfortunately, that's not what I'm looking for.
Getcell just gives me the RGB values for one pixel.
The fact is, when I want to use the color of a pixel instead of the average color of a frame part, I need to use a poly~ which slows down the patch at 200 instances.

djlbe's icon
Max Patch
Copy patch and select New From Clipboard in Max.

then you could use an uzi using this method, I was more wondering if the coodinates you uses in your text file were a grid. the fact to reduce the matrix using cv.jit.resize seems provide a good approximation of the mean value calculate by jit.3m. I don't have your imp.dmx object but I think it can work like that :