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

Nov 5, 2013 at 6:07am

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

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.

Thank you for looking into this,
ygr

<code>

– Pasted Max Patch, click to expand. –

</code>

#270190
Nov 5, 2013 at 6:23am

jit.3m

#270193
Nov 5, 2013 at 6:28am

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

#270194
Nov 5, 2013 at 6:29am

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

#270195
Nov 5, 2013 at 10:08am

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.

This way you get a higher average, since you’re not counting the black pixels…

<code>

– Pasted Max Patch, click to expand. –

</code>

#270233
Nov 5, 2013 at 12:35pm

Oh, my god!

You are a genius! Thank you so much!!

#270244

You must be logged in to reply to this topic.