I have been taking an online course in Python and I came across a line of code that I am unable to explain. I am trying to compute the sum of the red, green and blue channels of an image and the line of code to do so is:
img = plt.imread('480px-Astronaut-EVA.jpg')
intensity = img.sum(axis=2)
Why is axis=2 used to sum up the values of all the three channels? I am using the matplotlib library.
img? what library are you using? - iamanigeeit