Class Crop

Inheritance Relationships

Base Type

Class Documentation

class Crop : public mindspore::dataset::TensorTransform

Crop an image based on location and crop size.

Public Functions

Crop(const std::vector<int32_t> &coordinates, const std::vector<int32_t> &size)

Constructor.

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

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

参数
  • coordinates[in] Starting location of crop. Must be a vector of two values, in the form of {x_coor, y_coor}.

  • size[in] Size of the cropped area. 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).

~Crop() = default

Destructor.