colour_checker_detection.detection.swatch_colours#

colour_checker_detection.detection.swatch_colours(image: ArrayLike, masks: ArrayLike) NDArrayFloat[source]#

Extract the swatch colours from given image using given masks.

Parameters:
  • image (ArrayLike) – Image to extract the swatch colours from.

  • masks (ArrayLike) – Masks to use to extract the swatch colours from the image.

Returns:

Extracted swatch colours.

Return type:

numpy.ndarray

Examples

>>> from colour.utilities import tstack, zeros
>>> x = np.linspace(0, 1, 16)
>>> y = np.linspace(0, 1, 8)
>>> xx, yy = np.meshgrid(x, y)
>>> image = tstack([xx, yy, zeros(xx.shape)])
>>> swatch_colours(image, swatch_masks(16, 8, 4, 2, 1))  
array([[...0.1...,...0.2142...,...0...],
       [...0.3...,...0.2142...,...0...],
       [...0.6...,...0.2142...,...0...],
       [...0.9...,...0.2142...,...0...],
       [...0.1...,...0.7857...,...0...],
       [...0.3...,...0.7857...,...0...],
       [...0.6...,...0.7857...,...0...],
       [...0.9...,...0.7857...,...0...]]...)