Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kotoripiyopiyo/9b2a66c8f485e25d405a6b98f3ef66a2 to your computer and use it in GitHub Desktop.
Save kotoripiyopiyo/9b2a66c8f485e25d405a6b98f3ef66a2 to your computer and use it in GitHub Desktop.
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