Image.colororder2dict#
- static Image.colororder2dict(colororder, start: int = 0) dict[str, int][source][source]#
Parse a color order specification to a color dictionary
- Parameters:
colororder (str, dict) – order of color channels
start (int, optional) – starting index for plane numbering, defaults to 0
- Raises:
ValueError –
colorordernot 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:
AUTO_EDIT
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.colororder2dict('RGB') {'R': 0, 'G': 1, 'B': 2} >>> Image.colororder2dict('red:green:blue') {'red': 0, 'green': 1, 'blue': 2} >>> Image.colororder2dict({'L*': 0, 'U*': 1, 'V*': 2}) {'L*': 0, 'U*': 1, 'V*': 2}