Skip to content

Instantly share code, notes, and snippets.

@KelSolaar
Created December 15, 2015 22:42
Show Gist options
  • Save KelSolaar/ff3d2b46dc59b10675ec to your computer and use it in GitHub Desktop.
Save KelSolaar/ff3d2b46dc59b10675ec to your computer and use it in GitHub Desktop.
ColorChecker 2005 - Conversion
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\"dark skin\": [ 0.13661337 0.08811914 0.06215532]\n",
"\"light skin\": [ 0.45810491 0.31092185 0.2343693 ]\n",
"\"blue sky\": [ 0.14612224 0.19169378 0.31066182]\n",
"\"foliage\": [ 0.11491761 0.14392996 0.06438382]\n",
"\"blue flower\": [ 0.23051845 0.21995655 0.40432911]\n",
"\"bluish green\": [ 0.25984874 0.48388125 0.41833061]\n",
"\"orange\": [ 0.52733682 0.23641966 0.06353815]\n",
"\"purplish blue\": [ 0.0910839 0.10678083 0.36067988]\n",
"\"moderate red\": [ 0.38224453 0.11904141 0.12489356]\n",
"\"purple\": [ 0.08962977 0.04885743 0.1304555 ]\n",
"\"yellow green\": [ 0.38528573 0.4894399 0.10970652]\n",
"\"orange yellow\": [ 0.60929182 0.38449516 0.07668094]\n",
"\"blue\": [ 0.04218097 0.05193709 0.25788609]\n",
"\"green\": [ 0.13857416 0.27895388 0.09570813]\n",
"\"red\": [ 0.29211773 0.06066687 0.04832953]\n",
"\"yellow\": [ 0.71692914 0.57868619 0.09066445]\n",
"\"magenta\": [ 0.37289018 0.12379642 0.2864837 ]\n",
"\"cyan\": [ 0.08021685 0.2294435 0.37311665]\n",
"\"white 9.5 (.05 D)\": [ 0.912104 0.91450706 0.89653069]\n",
"\"neutral 8 (.23 D)\": [ 0.58459776 0.59119279 0.59303552]\n",
"\"neutral 6.5 (.44 D)\": [ 0.35911171 0.36467928 0.36708116]\n",
"\"neutral 5 (.70 D)\": [ 0.19082661 0.1916987 0.19289144]\n",
"\"neutral 3.5 (1.05 D)\": [ 0.08683356 0.08869352 0.09198612]\n",
"\"black 2 (1.5 D)\": [ 0.03077232 0.03114969 0.03256363]\n"
]
}
],
"source": [
"import numpy as np\n",
"\n",
"import colour\n",
"\n",
"name, data, illuminant = colour.COLOURCHECKERS['ColorChecker 2005']\n",
"for index, name, x, y, Y in data:\n",
" RGB = colour.XYZ_to_RGB(\n",
" colour.xyY_to_XYZ(np.array([x, y, Y])),\n",
" illuminant,\n",
" colour.ACES_CG_COLOURSPACE.whitepoint,\n",
" colour.ACES_CG_COLOURSPACE.XYZ_to_RGB_matrix,\n",
" 'CAT02',\n",
" lambda x: x)\n",
"\n",
" print('\"{0}\": {1}'.format(name, RGB))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.9"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment