Colour - Checker Detection - Examples: Segmentation

This notebook showcases segmentation retated colour checker detection examples.

The original *.CR2 files were processed with *dcraw* as follows: dcraw -T -g 2.4 12.92 *.CR2 and then resized and converted to *.png.
In [1]:
import cv2
import glob
import matplotlib.pyplot as plt
import numpy as np
import os

import colour

from colour_checker_detection import (
    EXAMPLES_RESOURCES_DIRECTORY,
    SETTINGS_SEGMENTATION_COLORCHECKER_CLASSIC,
    colour_checkers_coordinates_segmentation,
    detect_colour_checkers_segmentation)
from colour_checker_detection.detection.segmentation import (
    adjust_image)

colour.plotting.colour_style()

colour.utilities.describe_environment();
===============================================================================
*                                                                             *
*   Interpreter :                                                             *
*       python : 3.9.9 (main, Nov 21 2021, 03:16:13)                          *
*                [Clang 13.0.0 (clang-1300.0.29.3)]                           *
*                                                                             *
*   colour-science.org :                                                      *
*       colour : 0.4.1                                                        *
*       colour-checker-detection : v0.1.2-93-gadc72a0                         *
*                                                                             *
*   Runtime :                                                                 *
*       imageio : 2.16.0                                                      *
*       matplotlib : 3.4.3                                                    *
*       numpy : 1.22.2                                                        *
*       scipy : 1.8.0                                                         *
*       tqdm : 4.62.3                                                         *
*       opencv : 4.5.5                                                        *
*                                                                             *
===============================================================================

Data

In [2]:
COLOUR_CHECKER_IMAGE_PATHS = glob.glob(
    os.path.join(EXAMPLES_RESOURCES_DIRECTORY, 'detection', '*.png'))

COLOUR_CHECKER_IMAGES = [
    colour.cctf_decoding(colour.io.read_image(path))
    for path in COLOUR_CHECKER_IMAGE_PATHS
]

for image in COLOUR_CHECKER_IMAGES:
    colour.plotting.plot_image(colour.cctf_encoding(image));
/Users/kelsolaar/Library/Caches/pypoetry/virtualenvs/colour-checker-detection-4JNYxXhS-py3.9/lib/python3.9/site-packages/colour/utilities/verbose.py:262: ColourUsageWarning: "OpenImageIO" related API features are not available, switching to "Imageio"!
  warn(*args, **kwargs)