Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- import matplotlib.image as mpimg
- def rgb2gray(rgb):
- return np.dot(rgb[...,:3], [0.299, 0.587, 0.114])
- img = mpimg.imread('Hamburger_sandwich.jpg')
- gray = rgb2gray(img)
- plt.imshow(gray, cmap = plt.get_cmap('gray'))
- #imgplot = plt.imshow(img)
- #lum_img = img[:,:,0]
- #plt.imshow(lum_img)
- #plt.imshow(lum_img, cmap="hot")
- #imgplot = plt.imshow(lum_img)
- #imgplot.set_cmap('nipy_spectral')
- #imgplot = plt.imshow(lum_img)
- #plt.colorbar()
- #plt.hist(img.ravel(), bins=256, range=(0.0, 1.0), fc='k', ec='k')
- #imgplot = plt.imshow(lum_img, clim=(0.0, 0.7))
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement