mindspore.dataset.vision.c_transforms.Crop

class mindspore.dataset.vision.c_transforms.Crop(coordinates, size)[source]

Crop the input image at a specific location.

Parameters
  • coordinates (sequence) – Coordinates of the upper left corner of the cropping image. Must be a sequence of two values, in the form of (top, left).

  • 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

>>> decode_op = c_vision.Decode()
>>> crop_op = c_vision.Crop((0, 0), 32)
>>> transforms_list = [decode_op, crop_op]
>>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list,
...                                                 input_columns=["image"])