mindspore.dataset.vision.GaussianBlur

View Source On Gitee
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, int]]) – The size of the Gaussian kernel. Must be positive and odd. If the input type is int, the value will be used as both the width and height of the Gaussian kernel. If the input type is Sequence[int, int], the two elements will be used as the width and height of the Gaussian kernel respectively.

  • sigma (Union[float, Sequence[float, float]], optional) – The standard deviation of the Gaussian kernel. Must be positive. If the input type is float, the value will be used as the standard deviation of both the width and height of the Gaussian kernel. If the input type is Sequence[float, float], the two elements will be used as the standard deviation of the width and height of the Gaussian kernel respectively. Default: None , the standard deviation of the Gaussian kernel will be obtained by the formula \(((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: