I have an RGB image that has been converted to a numpy array. I'm trying to calculate the average RGB value of the image using numpy or scipy functions.
The RGB values are represented as a floating point from 0.0 - 1.0, where 1.0 = 255.
A sample 2x2 pixel image_array:
[[[0.0, 0.0, 0.0], [0.0, 0.0, 0.0]],
[[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]]]
I have tried:
import numpy
numpy.mean(image_array, axis=0)`
But that outputs:
[[0.5 0.5 0.5]
[0.5 0.5 0.5]]
What I want is just the single RGB average value:
[0.5 0.5 0.5]