Skip to content

Commit

Permalink
Update examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Mar 24, 2019
1 parent ff3bbde commit ee40af8
Showing 1 changed file with 46 additions and 71 deletions.
117 changes: 46 additions & 71 deletions colour_checker_detection/examples/examples_detection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,36 @@
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"===============================================================================\n",
"* *\n",
"* Interpreter : *\n",
"* python : 3.7.1 | packaged by conda-forge | (default, Mar 13 2019, *\n",
"* 05:40:40) *\n",
"* [Clang 4.0.1 (tags/RELEASE_401/final)] *\n",
"* *\n",
"* colour-science.org : *\n",
"* colour : v0.3.12-2-g9e02e488 *\n",
"* colour-checker-detection : 0.1.0 *\n",
"* *\n",
"* Runtime : *\n",
"* numpy : 1.16.2 *\n",
"* scipy : 1.2.1 *\n",
"* pandas : 0.24.2 *\n",
"* matplotlib : 3.0.3 *\n",
"* notebook : 5.7.6 *\n",
"* ipywidgets : 7.4.2 *\n",
"* OpenImageIO : 1.8.17 *\n",
"* opencv : 3.4.2 *\n",
"* *\n",
"===============================================================================\n"
]
}
],
"source": [
"from __future__ import division\n",
"\n",
Expand All @@ -32,7 +61,7 @@
"from collections import OrderedDict\n",
"\n",
"import colour\n",
"import colour.plotting\n",
"from colour.plotting import *\n",
"\n",
"from colour_checker_detection import (\n",
" EXAMPLES_RESOURCES_DIRECTORY,\n",
Expand All @@ -43,72 +72,18 @@
"\n",
"OETF = colour.RGB_COLOURSPACES['sRGB'].encoding_cctf\n",
"\n",
"EOTF = colour.RGB_COLOURSPACES['sRGB'].decoding_cctf"
"EOTF = colour.RGB_COLOURSPACES['sRGB'].decoding_cctf\n",
"\n",
"colour.utilities.describe_environment();"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'figure.figsize': (12.8, 7.2),\n",
" 'figure.dpi': 100,\n",
" 'savefig.dpi': 100,\n",
" 'savefig.bbox': 'standard',\n",
" 'axes.titlesize': 'x-large',\n",
" 'axes.labelsize': 'larger',\n",
" 'legend.fontsize': 'small',\n",
" 'xtick.labelsize': 'medium',\n",
" 'ytick.labelsize': 'medium',\n",
" 'text.color': '#111111',\n",
" 'xtick.top': False,\n",
" 'xtick.bottom': True,\n",
" 'ytick.right': False,\n",
" 'ytick.left': True,\n",
" 'xtick.minor.visible': True,\n",
" 'ytick.minor.visible': True,\n",
" 'xtick.direction': 'out',\n",
" 'ytick.direction': 'out',\n",
" 'xtick.major.size': 6.25,\n",
" 'xtick.minor.size': 3.75,\n",
" 'ytick.major.size': 6.25,\n",
" 'ytick.minor.size': 3.75,\n",
" 'xtick.major.width': 1,\n",
" 'xtick.minor.width': 1,\n",
" 'ytick.major.width': 1,\n",
" 'ytick.minor.width': 1,\n",
" 'axes.linewidth': 1,\n",
" 'axes.edgecolor': '#333333',\n",
" 'axes.titlepad': 7.5,\n",
" 'axes.facecolor': '#F5F5F5',\n",
" 'axes.grid': True,\n",
" 'axes.grid.which': 'major',\n",
" 'axes.grid.axis': 'both',\n",
" 'axes.axisbelow': True,\n",
" 'grid.linewidth': 0.5,\n",
" 'grid.linestyle': '--',\n",
" 'grid.color': '#D5D5D5',\n",
" 'legend.frameon': True,\n",
" 'legend.framealpha': 0.75,\n",
" 'legend.fancybox': False,\n",
" 'legend.facecolor': '#F0F0F0',\n",
" 'legend.borderpad': 0.5,\n",
" 'lines.linewidth': 1,\n",
" 'lines.markersize': 3,\n",
" 'lines.markeredgewidth': 0.75,\n",
" 'axes.prop_cycle': cycler('color', ['#F44336', '#9C27B0', '#3F51B5', '#03A9F4', '#009688', '#8BC34A', '#FFEB3B', '#FF9800', '#795548', '#607D8B'])}"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"colour.plotting.colour_style()"
"colour_style();"
]
},
{
Expand Down Expand Up @@ -160,7 +135,7 @@
"]\n",
"\n",
"for image in COLOUR_CHECKER_IMAGES:\n",
" colour.plotting.plot_image(OETF(image))"
" plot_image(OETF(image));"
]
},
{
Expand Down Expand Up @@ -211,8 +186,8 @@
" masks_i = np.zeros(colour_checker.shape)\n",
" for i, mask in enumerate(masks):\n",
" masks_i[mask[0]:mask[1], mask[2]:mask[3], ...] = 1\n",
" colour.plotting.plot_image(\n",
" OETF(np.clip(colour_checker + masks_i * 0.25, 0, 1)))"
" plot_image(\n",
" OETF(np.clip(colour_checker + masks_i * 0.25, 0, 1)));"
]
},
{
Expand Down Expand Up @@ -312,7 +287,7 @@
" OrderedDict(zip(REFERENCE_COLOUR_CHECKER.data.keys(), swatches_xyY)),\n",
" D65)\n",
" \n",
" colour.plotting.plot_multi_colour_checkers(\n",
" plot_multi_colour_checkers(\n",
" [REFERENCE_COLOUR_CHECKER, colour_checker])\n",
" \n",
" swatches_f = colour.colour_correction(swatches, swatches, REFERENCE_SWATCHES)\n",
Expand All @@ -323,12 +298,12 @@
" OrderedDict(zip(REFERENCE_COLOUR_CHECKER.data.keys(), swatches_f_xyY)),\n",
" D65)\n",
" \n",
" colour.plotting.plot_multi_colour_checkers(\n",
" plot_multi_colour_checkers(\n",
" [REFERENCE_COLOUR_CHECKER, colour_checker])\n",
"\n",
" colour.plotting.plot_image(OETF(\n",
" plot_image(OETF(\n",
" colour.colour_correction(\n",
" COLOUR_CHECKER_IMAGES[i], swatches, REFERENCE_SWATCHES)))"
" COLOUR_CHECKER_IMAGES[i], swatches, REFERENCE_SWATCHES)));"
]
},
{
Expand Down Expand Up @@ -402,18 +377,18 @@
" \n",
" image_a = adjust_image(image)\n",
"\n",
" colour.plotting.plot_image(OETF(segmented_image), text_parameters={\n",
" plot_image(OETF(segmented_image), text_parameters={\n",
" 'text': 'Segmented Image',\n",
" 'color': 'black'\n",
" })\n",
" \n",
" cv2.drawContours(image_a, swatches, -1, (1, 0, 1), 3)\n",
" cv2.drawContours(image_a, clusters, -1, (0, 1, 1), 3)\n",
"\n",
" colour.plotting.plot_image(OETF(image_a), text_parameters={\n",
" plot_image(OETF(image_a), text_parameters={\n",
" 'text': 'Swatches & Clusters',\n",
" 'color': 'white'\n",
" })"
" });"
]
}
],
Expand Down

0 comments on commit ee40af8

Please sign in to comment.