Class CenterCrop

Inheritance Relationships

Base Type

Class Documentation

class CenterCrop : public mindspore::dataset::TensorTransform

Crop the input image at the center to the given size.

Public Functions

explicit CenterCrop(const std::vector<int32_t> &size)

Constructor.

Parameters

size[in] A vector representing the output size of the cropped image. If the size is a single value, a squared crop of size (size, size) is returned. If the size has 2 values, it should be (height, width).

Example
/* Define operations */
auto decode_op = vision::Decode();
auto crop_op = vision::CenterCrop({32, 32});

/* dataset is an instance of Dataset object */
dataset = dataset->Map({decode_op, crop_op},  // operations
                       {"image"});            // input columns
~CenterCrop() = default

Destructor.