mindspore.dataset.vision.py_transforms.CenterCrop

class mindspore.dataset.vision.py_transforms.CenterCrop(size)[source]

Crop the central reigion of the input PIL image to the given size.

Parameters

size (Union[int, sequence]) – The output size of the cropped image. If size is an integer, a square crop of size (size, size) is returned. If size is a sequence of length 2, it should be (height, width).

Examples

>>> import mindspore.dataset.vision.py_transforms as py_vision
>>> from mindspore.dataset.transforms.py_transforms import Compose
>>>
>>> Compose([py_vision.Decode(),
>>>          py_vision.CenterCrop(64),
>>>          py_vision.ToTensor()])