mindspore.dataset.vision.c_transforms.GaussianBlur

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

Blur input image with the specified Gaussian kernel.

Parameters
  • kernel_size (Union[int, sequence]) – 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 (size, size). If a sequence of integer is provided, it must be a sequence of 2 values which represents (width, height).

  • sigma (Union[float, sequence], 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 the sigma of width and 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 integer or sequence of integer.

  • TypeError – If sigma is not of type float or sequence of 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

>>> transforms_list = [c_vision.Decode(), c_vision.GaussianBlur(3, 3)]
>>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list,
...                                                 input_columns=["image"])