You take the average value of only one axis, while you need to take the average value of two axes: the height and width of the image.
Try the following:
>>> image_array array([[[ 0., 0., 0.], [ 0., 0., 0.]], [[ 1., 1., 1.], [ 1., 1., 1.]]]) >>> np.mean(image_array, axis=(0, 1)) array([ 0.5, 0.5, 0.5])
As docs will tell you, you can specify a tuple for t21> the <parameter, indicating the axes along which you want the average value to be accepted.
source share