Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- img = plt.imread('photo2.jpg')
- R = img[:, :, 0]
- G = img[:, :, 1]
- B = img[:, :, 2]
- fig = plt.figure(figsize=(10, 10))
- columns = 4
- rows = 4
- fig.add_subplot(rows, columns, 1)
- plt.title("O")
- plt.imshow(img)
- fig.add_subplot(rows, columns, 2)
- plt.title("R")
- plt.imshow(R)
- fig.add_subplot(rows, columns, 3)
- plt.title("G")
- plt.imshow(G)
- fig.add_subplot(rows, columns, 4)
- plt.title("B")
- plt.imshow(B)
- fig.add_subplot(rows, columns, 6)
- plt.imshow(R, cmap=plt.cm.gray, vmin=0, vmax=255)
- fig.add_subplot(rows, columns, 7)
- Y = 0.2126 * R + 0.7152 * G + 0.0722 * B
- plt.imshow(Y, cmap=plt.cm.gray, vmin=0, vmax=255)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement