Skip to content

Instantly share code, notes, and snippets.

@ueblog
Created May 15, 2020 16:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ueblog/8b5518d25f46c9b63ee39b55b59cf45a to your computer and use it in GitHub Desktop.
Save ueblog/8b5518d25f46c9b63ee39b55b59cf45a 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