Skip to content

Instantly share code, notes, and snippets.

@twiddles
Last active May 25, 2017 11:55
Show Gist options
  • Save twiddles/848d86136e1e6210f3d47dac9adf541d to your computer and use it in GitHub Desktop.
Save twiddles/848d86136e1e6210f3d47dac9adf541d to your computer and use it in GitHub Desktop.
for source in SOURCES:
print('Processing:', source)
img = io.imread(source)
img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
filename = os.path.basename(source)
cv2.imwrite('processed_' + filename, img)
# Output
# Processing: lena.jpg
# Processing: monarch.png
# Processing: https://github.com/opencv/opencv/raw/master/samples/data/aero3.jpg
# Processing: https://github.com/opencv/opencv/raw/master/samples/data/fruits.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment