colour_checker_detection.detect_colour_checkers_templated#

colour_checker_detection.detect_colour_checkers_templated(image: str | ArrayLike, samples: int = 32, cctf_decoding: Callable = eotf_sRGB, apply_cctf_decoding: bool = False, segmenter: Callable = segmenter_templated, segmenter_kwargs: dict | None = None, extractor: Callable = extractor_templated, extractor_kwargs: dict | None = None, show: bool = False, additional_data: Literal[True] = True, **kwargs: Any) tuple[DataDetectionColourChecker, ...][source]#
colour_checker_detection.detect_colour_checkers_templated(image: str | ArrayLike, samples: int = 32, cctf_decoding: Callable = eotf_sRGB, apply_cctf_decoding: bool = False, segmenter: Callable = segmenter_templated, segmenter_kwargs: dict | None = None, extractor: Callable = extractor_templated, extractor_kwargs: dict | None = None, show: bool = False, *, additional_data: Literal[False], **kwargs: Any) tuple[NDArrayFloat, ...]
colour_checker_detection.detect_colour_checkers_templated(image: str | ArrayLike, samples: int, cctf_decoding: Callable, apply_cctf_decoding: bool, segmenter: Callable, segmenter_kwargs: dict | None, extractor: Callable, extractor_kwargs: dict | None, show: bool, additional_data: Literal[False], **kwargs: Any) tuple[NDArrayFloat, ...]

Detect the colour checkers swatches in specified image using templated methods.

Parameters:
  • image (str | ArrayLike) – Image (or image path to read the image from) to detect the colour checkers swatches from.

  • samples (int) – Sample count to use to average (mean) the swatches colours. The effective sample count is \(samples^2\).

  • cctf_decoding (Callable) – Decoding colour component transfer function / opto-electronic transfer function used when converting the image from 8-bit to float.

  • apply_cctf_decoding (bool) – Apply the decoding colour component transfer function / opto-electronic transfer function.

  • segmenter (Callable) – Callable responsible to segment the image and extract the colour checker rectangles.

  • segmenter_kwargs (dict | None) – Keyword arguments to pass to the segmenter. Can include ‘template’ as str (NPZ file path to template) or Template object. If ‘template’ not provided, defaults to built-in ColorChecker Classic template.

  • extractor (Callable) – Callable responsible to extract the colour checker data from the segmented rectangles.

  • extractor_kwargs (dict | None) – Keyword arguments to pass to the extractor.

  • show (bool) – Whether to show various debug images.

  • additional_data (bool) – Whether to output additional data.

  • greedy_heuristic (float, optional) – Heuristic threshold for early stopping in transformation search. Default is 2.0.

  • validation_threshold (float, optional) – Threshold for colour validation. Default is 0.5.

  • kwargs (Any)

Returns:

Tuple of DataDetectionColourChecker class instances or colour checkers swatches.

Return type:

tuple

Examples

>>> import os
>>> from colour import read_image
>>> from colour_checker_detection import ROOT_RESOURCES_TESTS
>>> path = os.path.join(
...     ROOT_RESOURCES_TESTS,
...     "colour_checker_detection",
...     "detection",
...     "IMG_1967.png",
... )
>>> image = read_image(path)
>>> detect_colour_checkers_templated(image, apply_cctf_decoding=True)
...
(array([[  1.07537337e-01,   4.11238223e-02,   1.31721459e-02],
       [  3.52024108e-01,   1.29535466e-01,   4.84532639e-02],
       [  9.00324881e-02,   8.14048126e-02,   6.83287457e-02],
       [  7.53633380e-02,   6.11113459e-02,   1.10184597e-02],
       [  1.46142766e-01,   8.32280964e-02,   7.74866268e-02],
       [  1.01110630e-01,   1.63705498e-01,   7.03689680e-02],
       [  4.23571885e-01,   1.02802373e-01,   6.50439737e-03],
       [  6.09256141e-02,   5.20781092e-02,   8.99062678e-02],
       [  3.42755497e-01,   5.93896434e-02,   2.91827880e-02],
       [  7.73139372e-02,   2.73966864e-02,   3.07213869e-02],
       [  2.03338221e-01,   1.79222777e-01,   2.65911571e-03],
       [  3.85695517e-01,   1.34022757e-01,   1.26003276e-03],
       [  3.15370820e-02,   2.88631991e-02,   6.08412772e-02],
       [  6.47268444e-02,   1.22600473e-01,   1.40322614e-02],
       [  2.66343951e-01,   3.76947522e-02,   1.44897113e-02],
       [  4.79563773e-01,   2.28976935e-01,   4.33672598e-04],
       [  2.93841749e-01,   5.43766469e-02,   5.89662455e-02],
       [  2.67328490e-02,   8.21092799e-02,   7.17147887e-02],
       [  5.15012801e-01,   3.33238840e-01,   1.63575962e-01],
       [  3.56554657e-01,   2.31821850e-01,   1.14737533e-01],
       [  2.27919579e-01,   1.48821548e-01,   7.34134316e-02],
       [  1.14748545e-01,   7.51190484e-02,   3.64632085e-02],
       [  5.69365770e-02,   3.84297743e-02,   1.82996020e-02],
       [  2.28971709e-02,   1.62528455e-02,   7.39292800e-03]]...),)