jit.iter can help here.
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...