Created
July 27, 2020 14:32
-
-
Save nimpy/84ae098c632c1b9179f0dddd5bb1df96 to your computer and use it in GitHub Desktop.
Convert an RGB image to a greyscale image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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