How to convert RGB matrix to Grayscale array in Python?

Viewed 17

I need an help to convert an array of rgb values (3 channels) into a single dimension grayscale array. Thank you so much.

1 Answers

If you are using PIL or Pillow to hold your RGB values as an image, the conversion is trivial:

gray_image = rgb_image.convert('L')
Related