Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
list sample
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
tokyo_tower = Image.open("tokyo_tower.png")
tower_color = np.array(tokyo_tower)
rgbcolor = ["red", "green", "blue"]
rgb_list = [0] * 3
for i in range(3):
rgb0, rgb1 = np.histogram(tower_color[:, :, i].flatten(), bins=256)
rgb_list[i] = rgb0
plt.figure(figsize=(10, 3))
plt.subplot(1, 2, 1)
plt.imshow(tokyo_tower)
plt.subplot(1,2,2)
for i in range(3):
plt.plot(rgb_list[i], color=rgbcolor[i])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment