mindspore.dataset.vision.Posterize

View Source On Gitee
class mindspore.dataset.vision.Posterize(bits)[source]

Reduce the bit depth of the color channels of image to create a high contrast and vivid color effect, similar to that seen in posters or printed materials.

Parameters

bits (int) – The number of bits to keep for each channel, should be in range of [0, 8].

Raises
  • TypeError – If bits is not of type int.

  • ValueError – If bits is not in range [0, 8].

  • RuntimeError – If shape of the input image is not <H, W> or <H, W, C>.

Examples

>>> import mindspore.dataset as ds
>>> import mindspore.dataset.vision as vision
>>>
>>> image_folder_dataset = ds.ImageFolderDataset("/path/to/image_folder_dataset_directory")
>>> transforms_list = [vision.Decode(), vision.Posterize(4)]
>>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list,
...                                                 input_columns=["image"])
Tutorial Examples: