machinevisiontoolbox.Image.colororder

property Image.colororder

Set/get color order of image

The color order is a dict where the key is the color plane name, eg. ‘R’ and the value is the index of the plane in the 3D pixel value array.

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image.Read('flowers1.png')
>>> img.colororder
{'R': 0, 'G': 1, 'B': 2}
>>> img.colororder = "BGR"
>>> img.colororder
{'B': 0, 'G': 1, 'R': 2}

When setting the color order the value can be any of:

  • simple string, one plane per character, eg. "RGB"

  • colon separated string, eg. "R:G:B", "L*:a*:b*"

  • dictionary, eg. dict(R=0, G=1, B=2)

For the first two cases the color plane indices are implicit in the order in the string.

Note:

Changing the color order does not change the order of the planes in the image array, it simply changes their label.

Seealso:

colororder_str colordict plane red green blue