Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Collonville
Created December 20, 2017 09:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Collonville/5b9aa1f1abac44c459414d781bc5ef18 to your computer and use it in GitHub Desktop.
Save Collonville/5b9aa1f1abac44c459414d781bc5ef18 to your computer and use it in GitHub Desktop.
import itertools
import numpy as np
import matplotlib.pyplot as plt
import colour
from colour.plotting import *
#RGBを0.0~0.1の間隔で分割し、組み合わせを列挙
line = np.linspace(0.0, 1.0, 15, endpoint=True)
rgb = np.array(list(itertools.product(line,line,line)), dtype=np.float)
#sRGBからXYZへ変換
XYZ = colour.sRGB_to_XYZ(rgb)
#XYZからxyへ変換
xy = colour.XYZ_to_xy(XYZ)
CIE_1931_chromaticity_diagram_plot(bounding_box=(-0.1, 0.9, -0.1, 0.9), standalone=False)
#sRGB領域へプロット
plt.plot(xy[:,0], xy[:,1], 'o', markersize=2, label="sRGB")
plt.legend()
display(standalone=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment