machinevisiontoolbox.Image.chromaticity

Image.chromaticity(which='RG')

Create chromaticity image

Parameters:

which (str, optional) – string comprising single letter color plane names, defaults to ‘RG’

Returns:

chromaticity image

Return type:

Image instance

Convert a tristimulus image to a chromaticity image. For the case of an RGB image and which='RG'

\[r = \frac{R}{R+G+B}, \, g = \frac{G}{R+G+B}\]

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image.Read('flowers1.png')
>>> img.chromaticity()
Image: 640 x 426 (float32), r:g
>>> img.chromaticity('RB')
Image: 640 x 426 (float32), r:b
Note:

The chromaticity color planes are the same as which but lower cased.

References:
  • Robotics, Vision & Control for Python, Section 10.2.5, P. Corke, Springer 2023.

Seealso:

tristim2cc