mindspore.dataset.vision.Invert

View Source On Gitee
class mindspore.dataset.vision.Invert[source]

Invert the colors of the input RGB image.

For each pixel in the image, if the original pixel value is pixel, the inverted pixel value will be 255 - pixel.

Raises

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

Supported Platforms:

CPU

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.Invert()]
>>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list,
...                                                 input_columns=["image"])
Tutorial Examples: