Image.mono#
- Image.mono(opt: str = 'r601') Self[source]#
Convert color image to monochrome
- Parameters:
opt (str, optional) – greyscale conversion mode, one of: ‘r601’ [default], ‘r709’, ‘value’ or ‘cv’
- Returns:
monochrome image
- Return type:
Return a greyscale image of the same width and height as the color image. Various conversion options are available:
optdefinition
'r601'ITU Rec. 601, Y’ = 0.229 R’ + 0.587 G’ + 0.114 B’
'r709'ITU Rec. 709, Y’ = 0.2126 R’ + 0.7152 G’ + 0.0722 B’
'value'V (value) component of HSV space
'cv'OpenCV colorspace() RGB to grey conversion
Example:
>>> from machinevisiontoolbox import Image >>> img = Image.Read('flowers1.png') >>> img Image(size=(640, 426), dtype=uint8, nplanes=3, colororder=R:G:B, name='.../images/flowers1.png') >>> img.mono() Image(size=(640, 426), dtype=uint8)
Note
For a monochrome image returns a reference to the
Imageinstance.- References:
P. Corke, Robotics, Vision & Control for Python, Springer, 2023, Section 10.2.7.
- Seealso: