I have a three-dimensional array of a image stored in a NumPy array. Using an algorithm, I converted the RGB image into grayscale. But in the third dimension the RGB values are same (for gray, the RGB values are same) and I want to convert all the three values into one and thus converting the three-dimensional array into two-dimensional one.
I.e, the current three-dimensional array is:
[[[24 24 24] [36 36 36].......[108 108 108]]
[[196 196 196] [45 45 45] ..... [90 90 90]]
...........................................
...........................................
[[80 80 80] [74 74 74] ..........[127 127 127]]]
The 2D array I want is:
[[24 36 ..........108]
[196 45 ......... 90]
[80 74 ..........127]]
How can I achieve this?