machinevisiontoolbox.Image.plane
- Image.plane(planes)[source]
Extract plane(s) from color image
- Parameters:
planes (int, list, str) – planes to extract
- Raises:
ValueError – if image is not color
- Return out:
image containing only the selected planes
- Return type:
Image
Create a new image from the selected planes of the image.
Example:
>>> from machinevisiontoolbox import Image >>> img = Image.Read("flowers4.png") # in BGR order >>> img.colororder_str 'R:G:B' >>> img.nplanes 3 >>> red = img.plane(0) # red plane >>> red Image: 640 x 426 (uint8) >>> red.iscolor False >>> red.nplanes 1 >>> green_blue = img.plane('G:B') # green and blue planes >>> green_blue Image: 640 x 426 (uint8), G:B >>> green_blue.iscolor True >>> green_blue.nplanes 2 >>> red_blue = img.plane([0, 2]) # blue and red planes >>> red_blue Image: 640 x 426 (uint8), R:B