mindspore.dataset.vision.GaussianBlur

class mindspore.dataset.vision.GaussianBlur(kernel_size, sigma=None)[source]

Blur input image with the specified Gaussian kernel.

Parameters
  • kernel_size (Union[int, Sequence[int]]) – Size of the Gaussian kernel to use. The value must be positive and odd. If only an integer is provided, the kernel size will be (kernel_size, kernel_size). If a sequence of integer is provided, it must be a sequence of 2 values which represents (width, height).

  • sigma (Union[float, Sequence[float]], optional) – Standard deviation of the Gaussian kernel to use. Default: None. The value must be positive. If only a float is provided, the sigma will be (sigma, sigma). If a sequence of float is provided, it must be a sequence of 2 values which represents (width, height). If None is provided, the sigma will be calculated as ((kernel_size - 1) * 0.5 - 1) * 0.3 + 0.8.

Raises
  • TypeError – If kernel_size is not of type int or Sequence[int].

  • TypeError – If sigma is not of type float or Sequence[float].

  • ValueError – If kernel_size is not positive and odd.

  • ValueError – If sigma is not positive.

  • RuntimeError – If given tensor shape is not <H, W> or <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(to_pil=True), vision.GaussianBlur(3, 3)]
>>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list,
...                                                 input_columns=["image"])
Tutorial Examples: