mindspore.dataset.vision.Erase
- class mindspore.dataset.vision.Erase(top, left, height, width, value=0, inplace=False)[source]
Erase the input image with given value.
- Parameters
top (int) – Vertical ordinate of the upper left corner of erased region.
left (int) – Horizontal ordinate of the upper left corner of erased region.
height (int) – Height of erased region.
width (int) – Width of erased region.
value (Union[int, Sequence[int, int, int]], optional) – Pixel value used to pad the erased area. Default:
0
. If int is provided, it will be used for all RGB channels. If Sequence[int, int, int] is provided, it will be used for R, G, B channels respectively.inplace (bool, optional) – Whether to apply erasing inplace. Default:
False
.
- Raises
TypeError – If top is not of type int.
ValueError – If top is negative.
TypeError – If left is not of type int.
ValueError – If left is negative.
TypeError – If height is not of type int.
ValueError – If height is not positive.
TypeError – If width is not of type int.
ValueError – If width is not positive.
TypeError – If value is not of type int or Sequence[int, int, int].
ValueError – If value is not in range of [0, 255].
TypeError – If inplace is not of type bool.
RuntimeError – If shape of the input image is not <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.Erase(10,10,10,10)] >>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list, ... input_columns=["image"])
- Tutorial Examples: