Created
March 2, 2018 00:21
-
-
Save bryanlimy/b82ad03983831f1da7b0ae0a12337b4d to your computer and use it in GitHub Desktop.
Python2 script to convert coloured image to grayscale
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 cv2 as cv | |
def convert(filename): | |
img = cv.imread(filename) | |
gray = cv.cvtColor(img, cv.COLOR_RGB2GRAY) | |
return cv.imwrite(filename, gray) | |
if __name__ == '__main__': | |
filename = raw_input('filename: ') | |
if filename: | |
print('status: ' + str(convert(filename))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment