mindspore.dataset.vision.py_transforms.Grayscale
- class mindspore.dataset.vision.py_transforms.Grayscale(num_output_channels=1)[source]
Convert the input PIL image to grayscale image.
- Parameters
num_output_channels (int) – Number of channels of the output grayscale image (1 or 3). Default is 1. If set to 3, the returned image has 3 identical RGB channels.
Examples
>>> import mindspore.dataset.vision.py_transforms as py_vision >>> from mindspore.dataset.transforms.py_transforms import Compose >>> >>> Compose([py_vision.Decode(), >>> py_vision.Grayscale(3), >>> py_vision.ToTensor()])