Skip to content

Instantly share code, notes, and snippets.

@nimpy
Created July 27, 2020 14:32
Show Gist options
  • Save nimpy/84ae098c632c1b9179f0dddd5bb1df96 to your computer and use it in GitHub Desktop.
Save nimpy/84ae098c632c1b9179f0dddd5bb1df96 to your computer and use it in GitHub Desktop.
Convert an RGB image to a greyscale image
import numpy as np
def rgb_to_greyscale(image):
return np.dot(image[...,:3], [0.2989, 0.5870, 0.1140])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment