Mean of total values of a matrix' plane without the 0 value pixels

ygreq's icon

Hi folks,

Any idea how I can find out the mean of all the values of a plane from a matrix?
Except for the 0 value which would ruin the whole calculations, of course.

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

Thank you for looking into this,
ygr

Tobias Rosenberger's icon
ygreq's icon

First thing is figuring out a way to get the pixels with 0 value out of the calculations.

And then calculate the mean from what remains.

By the way, I know about [jit.3m] mean value but the thing with the 0's still remain

ygreq's icon

Thank you, Tobias. I just read your message. Still trying to figure out how to exclude the 0's from the whole configuration.

Pedro Santos's icon

jit.iter can help here.
Steps:
Calculate the number of non-black pixel occurrences
Calculate the sum of all the pixels in the image (black is 0 so you don't need to filter it).
Divide it by the number of non-black pixels.

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

This way you get a higher average, since you're not counting the black pixels...

ygreq's icon

Oh, my god!

You are a genius! Thank you so much!!