colour_checker_detection.inferencer_default#

colour_checker_detection.inferencer_default(image: str | ArrayLike, cctf_encoding: Callable = eotf_inverse_sRGB, apply_cctf_encoding: bool = True, show: bool = False) NDArrayInt | NDArrayFloat[source]#

Predict the colour checker rectangles in given image using Ultralytics YOLOv8.

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

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

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

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

Returns:

Array of inference results as rows of confidence, class, and mask.

Return type:

np.ndarray

Warning

This definition sub-processes to a script licensed under the terms of the GNU Affero General Public License v3.0 as it uses the Ultralytics YOLOv8 API which is incompatible with the BSD-3-Clause.

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",
... )
>>> results = inferencer_default(path)  
>>> results.shape  
(1, 3)
>>> results[0][0]  
array(0.9708795...)
>>> results[0][1]  
array(0.0...)
>>> results[0][2].shape  
(864, 1280)