Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from matplotlib import pyplot as plt
- from matplotlib import image as mpimg
- import numpy as np
- import itertools
- from skimage import color
- img = color.rgb2gray(mpimg.imread("/home/henrik/pictures/grayscale_bench.png"))
- pyimg = img.tolist()
- mergedlist = list(itertools.chain(*pyimg))
- for x in mergedlist:
- if x < 0.51:
- mergedlist[x] = 0
- else:
- mergedlist[x] = 1
- print(mergedlist)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement