machinevisiontoolbox.Image.colordict
- static Image.colordict(colororder)[source]
Parse a color order specification
- Parameters:
colororder (str, dict) – order of color channels
- Raises:
ValueError –
colororder
not a string or dict- Returns:
dictionary mapping color names to plane indices
- Return type:
dict
The color order the value can be given in a variety of forms:
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)
Example:
>>> from machinevisiontoolbox import Image >>> Image.colordict('RGB') {'R': 0, 'G': 1, 'B': 2} >>> Image.colordict('red:green:blue') {'red': 0, 'green': 1, 'blue': 2} >>> Image.colordict({'L*': 0, 'U*': 1, 'V*': 2}) {'L*': 0, 'U*': 1, 'V*': 2}