mindspore.dataset.vision.RandomAdjustSharpness

class mindspore.dataset.vision.RandomAdjustSharpness(degree, prob=0.5)[source]

Randomly adjust the sharpness of the input image with a given probability.

Parameters
  • degree (float) – Sharpness adjustment degree, which must be non negative. Degree of 0.0 gives a blurred image, degree of 1.0 gives the original image, and degree of 2.0 increases the sharpness by a factor of 2.

  • prob (float, optional) – Probability of the image being sharpness adjusted, which must be in range of [0.0, 1.0]. Default: 0.5.

Raises
Supported Platforms:

CPU

Examples

>>> import numpy as np
>>> import mindspore.dataset as ds
>>> import mindspore.dataset.vision as vision
>>>
>>> # Use the transform in dataset pipeline mode
>>> data = np.random.randint(0, 255, size=(1, 100, 100, 3)).astype(np.uint8)
>>> numpy_slices_dataset = ds.NumpySlicesDataset(data, ["image"])
>>> transforms_list = [vision.RandomAdjustSharpness(2.0, 0.5)]
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms_list, input_columns=["image"])
>>> for item in numpy_slices_dataset.create_dict_iterator(num_epochs=1, output_numpy=True):
...     print(item["image"].shape, item["image"].dtype)
...     break
(100, 100, 3) uint8
>>>
>>> # Use the transform in eager mode
>>> data = np.random.randint(0, 255, size=(100, 100, 3)).astype(np.uint8)
>>> output = vision.RandomAdjustSharpness(2.0, 1.0)(data)
>>> print(output.shape, output.dtype)
(100, 100, 3) uint8
Tutorial Examples: